Workflow Logic
- Workflow logic would be
Action
|
Status
|
Item
Permission
|
On Item Submit
|
Pending with Manager
|
Created by – Read
Manager -
Contribute
|
Item Approved by Manager
|
Closed
|
Created by – Read
Manager – Read
|
- As shown in below screen shot. Add App Step to the workflow.
- When we assign permission on an item, there are 2 steps for that.
- Break Role Inheritance: It will stop inheriting permission from parent list and also using Copy Role Assignments =false parameter it will remove all the existing permissions from that item.
- Assign Permissions: In the second step we will assign permission to the desired users.
Breaking Role Inheritance
- Add below steps to the workflow
- Create a REST URL for breaking role inheritance as shown below
- Add two headers as shown below.
- Next step would be to build a dictionary for headers and name it as “Request Headers”.
- Now Insert call a web service action.Select URL that we prepared above.Method Type : POST
Accept :
application/json;odata=verbose
Content-Type:
application/json;odata=verbose
In the response code, create a variable named responseCode.
In the Properties section as show below, select Request Headers
- Now publish the workflow. Create an item in the list and once the workflow execution completes, check the permissions on that item.
Assign Permissions - Pending With Manager
- Add Steps mentioned above for “Assign Read Permission to Created By”.
- Set Variable URL as mentioned below.
- Build Dictionary same as mentioned in previous step and assign it to Request Headers Properties section of call a web service action.
- Make a Post Call and Publish the workflow.
- If I check the item level permissions, now Created by user has read permission and Manager has contribute permission
Assign Permission - Approved/Rejected by Manager
- After above steps, item is now pending with manager for approval.
- After approval/rejection, we need to set permissions on that item as below.
- Read for Created by
- Read for Manager
- Since Read permission to Created by is already assigned so we do not have to modify anything for that user.
- Now to assign read permission to Manager, we need to follow below steps.
- Remove Contribute permission for Manager.
- Assign read permission for manager.
- To remove contribute permission for manager and assigning read permission, add actions as below.
- For removing manager permission, use below URL and use “DELETE” as the http method
- For assigning read permission to manager. Add actions as specified in above screenshot highlighted as green.
- Use below URL and use “POST” as the http method
- Assign Request Header.
- Publish the workflow.
- In the previously created item, edit the same and in Manager Approval select as approved or rejected and click on save.
- Now check permissions on item
No comments:
Post a Comment