string formLink = default(string);
string strSubject=string.Empty; // mail Subject
string strBody = string.Empty; ;//Mail body
string strToMailIDs = string.Empty; ;//mail To ID's
string strfrom = string.Empty; ;//Mail From ID's
int itaskID = Convert.ToInt32(onTaskCreated_BranchManger.AfterProperties.TaskItemId);//Getting current task ID
int iUserID = Convert.ToInt32(workflowProperties.Item["ID"]); // Getting the UserID behind the task ID
formLink = this.workflowProperties.Item.Web.Url + "/Lists/Task/DispForm.aspx?ID="+itaskID;
formLink = "<a href='" + formLink + "'>Click here</a>"; // Item approve/reject link
SPWeb web = this.workflowProperties.Item.Web;
//Updating the Task list title with task list ID
SPListItem lstItem = workflowProperties.TaskList.Items.GetItemById(itaskID);
web.AllowUnsafeUpdates = true;
lstItem["Title"] = "Branch Manager Aproval Request for ID " + itaskID;
lstItem[SPBuiltInFieldId.WorkflowVersion] = 1;
lstItem.SystemUpdate();
web.AllowUnsafeUpdates = false;
//End Updating the Task list title with task list ID
//getting the Email Template from the list, ET001 code is for Branch manager
strToMailIDs = BranchmangerworkflowtaskProperties.ExtendedProperties["ApprovalManager"].ToString();
strfrom = BranchmangerworkflowtaskProperties.ExtendedProperties["ApprovalManager"].ToString();
SendMail(web, strSubject, strBody, strToMailIDs, strfrom); //sending email from branch manager
web.Dispose();
}
No comments:
Post a Comment