In SharePoint 2013 workflow architecture is drastically changed when compared with SharePoint 2010. Some new activities like “HttpSend” are introduced for the platform and some activities are improved a whole lot. On the other hand some scenarios became quite hard to implement.
Let’s assume that we’ve a SharePoint 2013 Visual Studio primarily based workflow and require to assign a task to a user. We count on the notification e mail to contain the hyperlink to respective task. is not it ?
In SharePoint 2010 it was quite easy to include the process url in the mail. But which is not the case anymore. It’s not achievable to include the task url in the default mail. As an alternative it’s sent like below that is not user friendly.
In this post I’ll show a workaround to resolve the problem. Following are the steps we need to perform
- Add “SingleTask” activity and configure necessary parameters
- Modify WaitForTaskCompletion property to false
This will avoid the “SingleTask” activity to wait until the approval. Furthermore change “WaiveAssignmentEmail” property value to “Yes” which avoids the notification email. - Compose an email manually
In this email I’ll include a link to assigned task. To get the guid of task list, I will use “GetTaskListId” activity. Furthermore I’ll get the task id from “SingleTask” activity output.From those elements I’ll construct the url of the assigned taske.g.: “http://sp13/sites/dev/DOAApprovalForm.aspx?List=”+taskListId.ToString()+”&ID=”+taskItemId+”
Then I’ll construct the email body as I wish
“<html><body style=’font-size:11pt;font-family:Segoe UI Light,sans-serif;color:#444444;’><div>Contract comment is : ” + contractComment+ ” </br>Please approve this <a href=”+siteUrl + “SitePages/DOAApprovalForm.aspx?List=”+taskListId.ToString()+”&ID=”+taskItemId+”>Task</a></div></body></html>”
- Handle Approve or Reject actions using a “Pick” activityWe will use “WaitForFieldChange” activity to pause the workflow until user presses Approve or Reject buttons. Since there are two possible values in the pausing field we need to use a “Pick” activity
- As mentioned earlier, we will use “WaitForFieldChange” activities on both branches, configured for “TaskOutcome” field.
For the first “WaitForFieldChange” activity, the FieldValue is set to “Approved” and for the other one it is “Rejected”
- I’ll update the taskOutcome with respective values to continue the workflow
This will allow us to modify email as we wish and pause the workflow until the task is approved or rejected
Best Recommended SharePoint 2013 Hosting
ASPHostPortal.com
ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability