Friday, April 21, 2017

Item level Permission - SPD Workflow 2013 - Part 1

Follow below steps to apply item level permission in SharePoint Online using SharePoint Designer Workflow.

Scenario: If an employee visits some other location for officially then expenses would be reimbursed but for that there would be an approval cycle. Once employee submits the expenses then it would be approved by Manager. For that we will follow below steps.

REST API’s to be used


                              URL
Method Type
Break Role Inheritance
/_api/web/lists/getByTitle('User Access Requests List')/items(itemId)/breakroleinheritance(copyRoleAssignments=false, clearSubscopes=true)
POST
Add Permission of user
/_api/web/lists/getByTitle('User Access Requests List')/items(itemId)/roleassignments/addroleassignment(principalid=UserId,roleDefId=rId)
POST
Remove Permission of User
/_api/web/lists/getByTitle('User Access Requests List')/items(itemId)/roleassignments/getbyprincipalid(userId)
DELETE


List Creation

  •   Create a list: I have a demo list namely “Demo List” and with few columns.

Column Name
Type
Title
Single Line of Text
Location Visited
Single Line of Text
Expenses
Number
Manager
User
Status
Choice

  •      Status field would be having below options.

a.       Pending with Manager  - Default value
b.      Closed



No comments:

Post a Comment