Wednesday, November 1, 2017

SharePoint Online Designer Workflow 2013 : Accessing "People Picker" properties

When we are accessing a out list (A list which is not associated with a Workflow ) which has a people picker and if you need to access it's data properties such as UserName (Name in SP Online terms) or Email or Department. Though it's pretty much straight forward you might mislead by trying to looking to that in REST JSON , or d result angel. it's bit tricky. Anyway before start it's advisable to go through (SharePoint Online Designer Workflow 2013 : Calling REST API & Looping through list items - d results) following article which explains how to get results using REST calls and do the required iteration.

Ok once you finished that article, here are the modification that you must do.

Modification.

a people picker column been added to the same list (UserDetail) called UserID



1) REST call URL
in your REST call url insted of this "/_api/web/lists/getbytitle('UserDetail')/items" which is given commonly access to all items . modified it to "/_api/web/lists/getbytitle('UserDetail')/Items?$select=*,UserID/EMail&$expand=UserID/Id" here you are taking EMail property out separately and  expand the people picker column based on Id, while havving all other columns available "select=*," . it looks like this. yeah looks bit messy.


Let's add this URL to the Workflow

Then let's goto the loop and Add UserID/EMail to the get Dictionery action item. what it dose , it extract the Email from the user object in the People Picker and added to the WF variable.



Now when we run the WF, here is the outcome.



ok That's It ... 
HAPPY CODING

No comments:

Post a Comment