Wednesday, October 17, 2012

Redirecting after Workflow Task page

In SharePoint Designer, I created a workflow that contains multiple approval workflows.  In the emails that are sent out by the approval workflows, a link is contained that sends the user to a URL that allows the user to approve, reject, etc.  (I know this functionality is included in Outlook 2010, but this is not what the key users wanted)

The URL is called using the variable [%Current Task:Form_URN%], which works fine, but when Approve or Reject is clicked, it takes the user to the Workflow Tasks list, not the main site landing page as is required.

The solution I found here is to simply add a Source query string parameter to the address in the email.  For example:

[%Current Task:Form_URN%]&Source=http://sharepoint/sitename

This creates a URL similar to the below:

http://sharepoint/sitename/_layouts/WrkTaskIP.aspx?List=%7Bd5cdf49b%2Da735%2D4669%2D8ce3%2Dc26d17666941%7D&ID=83&Source=http://sharepoint/sitename

Clicking on Approve or Reject (or, indeed, any other options you've added to the task) will then take the user back to the Source page instead, enhancing the user experience.  In theory, adding &Source to any SharePoint URL will have the same effect, which is extremely useful.

No comments:

Post a Comment