Forum Discussion
Automatically fill a single text column in Lists by the value of a Person Field column
- Jun 13, 2023
Femke11 If you just want to show the email address in the list view, you can easily do it using JSON formatting like:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "[$PersonGroupCol.email]" }
Where PersonGroupCol is internal name of person or group field. You can get the internal name of your person or group column by following this article: How to find the Internal name of columns in SharePoint Online?
You can read more information about this approach in my answer given at: Get Email from user and enter into SharePoint list field
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
Femke11 the quickest & easiest way of doing this is to build another flow which is triggered from a JSON-formatted button in the list. So in the example below Pick is a person column, Get email is a single line of text column and so is PickEmail.
In the flow the trigger is the SharePoint "for a selected item". Next add a get item action to get the details of the item selected.
Next, add an Office 365 users get user profile (v2) and select one of the Pick columns in the dynamic content box. I've selected Pick Email but you could equally select Pick DisplayName or one of the others.
Finally, add a SharePoint "update item" action and select Mail from the get user profile from the dynamic content box.
Name & save your flow and get the flow ID from the flow's address bar which you'll need in the JSON.
Back in the list format the GetEmail column in advanced mode, delete the existing code and paste in the following JSON, changing the ID to your flow's ID
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"txtContent": "Get email",
"customRowAction": {
"action": "executeFlow",
"actionParams": "='{\"id\":\"88823897-8dd5-4452-934d-a980defd39a9\", \"headerText\":\" ' + [$Title] + '\",\"runFlowButtonText\":\"Get email\"}'"
},
"style": {
"background-color": "#cf000f",
"color": "white",
"border-radius": "10px"
}
}
After you select the person, click the button and after a few seconds the Pick Email column will get populated.
Rob
Los Gallardos
Microsoft Power Automate Community Super User
Thank you so much for this good explanation, it works perfectly! Do you know if other people can use the 'Get email' button in this list as well?