Develop workflows in SharePoint - Part 5



Published: 15 August 2017

This is the fifth post of this series, we will be creating sequential workflow in SharePoint. 

Lets start..

Sequential Workflow

Task 1: Create Sequential workflow

Step 1. Open Site in SharePoint Designer. 

Step 2. Click Workflows => List Workflow => Training Details.

Step 3. Enter name as Training Approval, description and choose platform SharePoint 2013 Workflow.

 Step 4.  Click OK. Below is the default workflow.

 Step 5. Add stages, actions, conditions etc., according to our requirement. 

Finally, how it should look like is.

Step 6. Rename Stage 1, for that click on Stage 1 and enter "Approval Stage." 

Log Training name to workflow history list:

It helps to debug.

Step 7. Add Training name to workflow history list. Focus on Start typing and from ribbon => Actions => Log to history.

Step 8. Click this message link from Log, click Add button, it opens a window. 

 Step 9. Enter message Training Name: => Click button "Add or change Lookup."

Step 10. Select Data Source: Current item and 

               Field from source: Training Name

Step 11. Click OK button. It looks as below.

Step 12. Click OK button.

Assign Task to Manager:

Step 13. From ribbon => Action => Assign a Task.

This is to create an approval task in Tasks List and to assign specified person for Approval.

Step 14. Click this user. Opens a below window.

Step 15. Add participants: 

Click button  against Participant, it opens below window.

Step 16. Select Workflow Lookup for User… => click Add button.

The below window appears. Select 

  i. Data source: Current Item 

 ii. Field from source: Manager 

iii. Return field as: Display Name. 

Step 17. Click OK button. You can see selected users.

The below window shows participants.

Step 18. Click OK on all popups.

Step 19. Add Task Title:

In Task Title window, enter “Please approve training request”.

Step 20. Description:

Enter below content as description.

Requestor: [%Current Item:Created By%]

Training Start Date: [%Current Item:Start Date%]

Training End Date: [%Current Item:End Date%]

Step 21. Open Task Options and select Current Item for Associated Item.as shown above.

Assign tasks that look like as below. 

Step 22. Add log outcome variable to workflow history list.

Step 23. Ribbon => Actions => Log to history.

Step 24. Click message link from Log, click Add button, it opens a window. 

Step 25. Enter message Task Outcome: => click button Add or change Lookup and select values as shown in below window.

Step 26. Clock OK. This looks as below.

It looks as below.

Step 27. Next step is, add if condition to check approved. Ribbon => Condition => If any value equals value.

It looks as below.

Step 28. Click value before equal, select values as shown in below window.

Step 29. Click OK.

Step 30. Click on value after equals. Select Approved as shown below.

Step 31. Ribbon => Actions => Set workflow.

Step 32. Add message as Approved.

Step 33. Ribbon => Actions => Send email.

Step 34. Click these users, opens a window like below.

Step 35. Add members to send mail. Click on button “To” to add members as shown below.

Step 36. Add manager to CC as shown in above steps.

Step 37. Add Subject “Training Request has been approved”

Step 38. Add below text as mail body: 

Hi [%Current Item: Created By%],

Your request for training has been approved.

Regards,

[%Current Item: Manager%]

Step 39. Same way add one more if the condition is for rejected request. Follow same steps as we did for approved.

Ribbon => Condition => if any value equals value.

Replace approved with rejected.

We finished building workflow and reached to final step.

Step 40. Focus on "Transition to stage" => Action => Go to a stage.

Step 41. Click a stage, select End of Workflow.

Step 42. Before publishing, the best practice is to check for error. Click on Check For Errors button (find lift navigation), if no errors, click Publish.

Step 43. Select Start Options, start workflow automatically when an item is created.

Step 44. Republish.

Task 2: Test workflow 

Step 1. Open list Training Details and add a new item. 

Step 2. Workflow automatically starts and send notification mail to Manager.

Step 3. If the manager clicks on the link, it will directly open the item.

Step 4. Here manager approved, so approval email sends to the trainee.

Step 5. When workflow starts it creates a new item in Workflow Tasks list. And maintain completion status. You can check.

Step 6. Workflow History list logs workflow status changes.

Conclusion:

In this post, you have learned how to create sequential workflow using SharePoint Designer 2013.

Your Turn

Do you have any specific things related to workflows that you want me to cover as part of this series?. Please leave a comment below, so i can include those as part of this series.



Join 6,500 subscribers and receive instant access to

Devendra's Library of Resources for SharePoint Developers


About Author

Devendra Velegandla is a four-time recipient of Microsoft's Most Valuable Professional (MVP) award (2014-2017) for Office Servers and Services MVP and  SharePoint Server. He received the MCC award for his contributions in Microsoft MSDN/TechNet forums. He loves sharing articles, videos, and tutorial on SharePoint and Office 365.