How to extract the Email, Login name and Title (i.e. name of the person) from a person field using lookup?
AnsweredHi Team,
I currently have a "Approvers" list containing the following columns.
Approvers List:
1. Role - single line text field defining the user role
2. Approver - this is SharePoint people picker field
I have another list where I'm using the "Get Items" & "loop: apply to each" action within the modern form button to get all the relevant information.
Within the loop action, I'm able to extract the role name using =[[@Actions.Loop_apply_to_each_approver.CurrentItem]].Role
However, if i try that with the person field (=[[@Actions.Loop_apply_to_each_approver.CurrentItem]].Approver), i get [Object object] as the result.
How can i extract the details (i.e. email, login name and the Title) of the approver?
Thanks
-
Hi Sid Raj,
yes you can get the email and the title using functions like this:
[[@Actions.Loop_apply_to_each_approver.CurrentItem]].Approver.get_email()
[[@Actions.Loop_apply_to_each_approver.CurrentItem]].Approver.get_lookupValue()
or the ID (since a person field is a lookup technically) [[@Actions.Loop_apply_to_each_approver.CurrentItem]].Approver.get_lookupId()The person field (Approver) is returned as a SP.FieldUserValue which has those functions.
You can also check this in the Browser Console (F12) by stopping at a debugger point somewhere in your actions/expressions using function expression:
Kind regards
Matthias
0 -
Thanks Matthias. This worked for me.
I was actually trying to present this information via the "Show message" action. In order to do this, I had to create a variable, add and evaluate the expression (as provided above) and then embed the variable within the "Show message" action. Overall this worked out for me. Thanks so much.
0 -
The problem with the Show message action is, that it converts everything into a string, where you will not have these details about the object.
BR Matthias
0
Please sign in to leave a comment.
Comments
3 comments