Sunday, May 27, 2012

Run Workflow from Hyperlink in SharePoint List

There is an  easy way for the users to start a workflow from the link instaed of selecting from item menu and then select the workflow from the available workflows and then start workflow from the workflow start form.

In this example i am going to update the list item with the workflow that is triggred from the hyprtlink in the SharePoint list


1) First create a workflow to update any list item in the SharePoint site List.
In the workflow settings click the "Allow this workflow to be manually started" and leave other checkboxes unchecked.

2) Publish the workflow, then go to the list to which this workflow is associated, select any item and then from the item menu select workflows. This will lead you to the workflows form attached with this list.




3) Click on your workflow that you created earliar to update item and this will redirect you the workflow start form.




4) Copy the url of this form from the address bar. This would be like
yoursite/_layouts/IniWrkflIP.aspx?List={9a6f5d9b-f075-43a3-a940-dafd1191477b}&ID=117&TemplateID={7b6230c2-8e22-4e7d-b167-6e68bce3a22c}&Source=yoursite/yourlist/forms/allitems.aspx

This url contains List={guid of list}, ID item id list item, TemplateID={GUID of the workflow} and source={after completion of the workflow it will redirect to this url}

5) Now create a field in this list called "start workflow" of type hyperlink. We will use this field to trigger the workflow.

6) Create another list workflow on this list called "populate start workflow link". Check the "Start workflow automatically when an item is created" in the properties window of this workflow

a) In step 1 of the workflow, create a variable named link of string type and set its value to the url of the workflow start form we copied in the step 4 as described in the following image.After the url put a comma',' and put a white space and then put a word you want to display in list otherwise it will show whole url. In this example i have used the "Publish". See image below


b) Now create another action "Update List Item". In the Item select current item and the set the field "start workflow" to this varibale as described in the below image. I have used the "Publish" field in this example.



c) Now save and publish the workflow. Whenever new item will be created a link will be created in the list and that link will redirect you to the satrt workflow form.






This is an effective and easy way for the end users to start workflow from the hyperlink field in the list


1 comment:

  1. Varinder - I just wanted to let you know that I followed your instructions here, and set this up, and it worked perfectly. Thank you for taking the time to post this.

    ReplyDelete