Redirect Workflow Page after starting

December 16, 2013

Sometime you create a Workflow (WF) and you don’t want it to redirect to the initial list where it was started from.

But rather to a Display Form or an Edit Form of the record that triggered the WF.

Let’s see how to redirect a workflow to a different page after starting.

1. In the style sheet create a parameter that will contain the URL of the form to which to redirect to :

<xsl:variable name=”RedirectDisp“>../../Lists/YourList/DispForm.aspx?ID=<xsl:value-of select=”$Id“/></xsl:variable>

Where $ID is the ID of the list item

image
2. Then change the start button from the WF page :

<td nowrap=”nowrap” class=”ms-vb”>
<input type=”button” value=”Start” name=”btnSave” onclick=”javascript: {ddwrt:GenFireServerEvent(concat(‘__insert;__commit;__redirectsource;__redirectToList={‘,ddwrt:EcmaScriptEncode($ListName),’};‘))}” />
</td>

To

<td nowrap=”nowrap” class=”ms-vb”>
<input type=”button” value=”Start” name=”btnSave” onclick=”javascript: {ddwrt:GenFireServerEvent(concat(‘__insert;__commit;__redirect={‘,$RedirectDisp,’}‘))}” />
</td>

image

That’s it.