In this article, we will create a simple approval workflow in which approver is selected dynamically from another list using Sharepoint Designer 2013. We will implement the following approver hierarchy:
In a document library, if User1 or User2 creates any document then it will be approved by Manager1. Similarly, Administrator will approve documents created by Manager1 and Manager2.
Video:
Here is the full video tutorial:
Creating Approver List:
To define the approver for the user, we create a list.
Click “Settings” icon > Add an app > Custom List
Enter Name “Approver Info” > click Create
Enter Name “Approver Info” > click Create
Open “Approver Info” list
In Top Ribbon List > List Settings
Click “Title” in Columns and rename to Department > OK
Click “Create Column” and enter following information
Name: “Editor”
Type: “Person or Group”
Require that this column contains information: Yes
Allow multiple selections: No
Allow selection of: People Only
Choose from: All Users
In Top Ribbon List > List Settings
Click “Title” in Columns and rename to Department > OK
Click “Create Column” and enter following information
Name: “Editor”
Type: “Person or Group”
Require that this column contains information: Yes
Allow multiple selections: No
Allow selection of: People Only
Choose from: All Users
Similarly create “Approver” column and enter data.
Creating Workflow:
1. Open Document Library > In Library Ribbon: Workflow Settings > Click “Create a Workflow in Sharepoint Designer”
2. Click “Allow”, It will open Sharepoint designer, Enter Name “Approval Workflow” and description > OK
2. Click “Allow”, It will open Sharepoint designer, Enter Name “Approval Workflow” and description > OK
3. In Workflow Ribbon > Action > “Set Workflow Status” > Enter “Pending”
4. just below of this action, add new action “Set Workflow Variable”
click “Workflow Variable” > “Create a new variable” > Set Name “Approver” and Type “String“.
click value > click function icon > set following values:
4. just below of this action, add new action “Set Workflow Variable”
click “Workflow Variable” > “Create a new variable” > Set Name “Approver” and Type “String“.
click value > click function icon > set following values:
Find Data to Retrieve:
Data source: Approver Info
Field from source: Approver
Return field as: Login Name
Data source: Approver Info
Field from source: Approver
Return field as: Login Name
Find the List Item
Field: Editor
Value: click function icon > select Datasource : Current Item, Field from source: Created By, Return field as “Login Name”
Field: Editor
Value: click function icon > select Datasource : Current Item, Field from source: Created By, Return field as “Login Name”
5. just below of this action, add new action > “Start a task process”
Click “these users“, click … for participants
Select “Workflow Lookup for a User” > Add
Select Data Source “Workflow Variables and Parameters“, Field from source : Variable :Approver, Return field as: String > OK
OK
Enter Task Title and Description
click OK
Click “these users“, click … for participants
Select “Workflow Lookup for a User” > Add
Select Data Source “Workflow Variables and Parameters“, Field from source : Variable :Approver, Return field as: String > OK
OK
Enter Task Title and Description
click OK
6. After this action, click Condition > “if any value equals value”
click first value, click function icon
Data source: “Workflow Variables and Parameters”
Field from source : Variable : Outcome
click first value, click function icon
Data source: “Workflow Variables and Parameters”
Field from source : Variable : Outcome
click second value, select approved
7. In If condition, Add action “Set Workflow Status” > Enter “Approved”
8. In workflow ribbon > click “Else Branch”, Add action “Set Workflow Status” > Enter “Rejected”
9. below of “Transition to stage”
8. In workflow ribbon > click “Else Branch”, Add action “Set Workflow Status” > Enter “Rejected”
9. below of “Transition to stage”
Add Action > “Go to a stage”
click “a stage” > select “End of Workflow”
click “a stage” > select “End of Workflow”
Save it. Now the workflow looks like below:
10. Click on “Workflow Settings” in ribbon and check “Start workflow automatically when an item is created” in Start options.
11. Publish the workflow.
11. Publish the workflow.
Filtering Task List:
Now user wants to see their tasks only. So In the view, to display the tasks of the current user only:
Open Task library > List ribbon > List Settings
Click “All Tasks” in Views
Click “All Tasks” in Views
In filter section, select “Show items only when the following is true:” and set condition “Assigned to is equal to [Me].
When user1 creates any document, A task is assigned to Manager1. When Manager1 approves the request then the status will become approved.
Conclusion:
We have implemented a very simple Sharepoint designer 2013 workflow where approver is defined by another custom Sharepoint list.
Enjoy Sharepoint !!
No comments:
Post a Comment