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 You cannot use person or group columns in the calculated column formula. So, you cannot get user name from person field using calculated columns.
Above JSON I provided in my response only works for showing the email in list view. It is not saving the actual email/name value in the column. So, you cannot use it in lookup columns.
If you want the actual value to be stored in the column, you will have to use the Power automate flow on item creation/update. Follow this response: Automatically fill a single text column in Lists by the value of a Person Field column
Let me know if you are stuck while creating such power automate flow, I will try to show some examples in that case.
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.
Thanks again! Totally clear to me now. And the flow works perfectly (both: with the button, as RobElliot explained, and with the 'When an item is created or modified'-trigger).
For people who are interested in the flow, here's a screenshot:
- ganeshsanapJun 14, 2023MVP
Femke11 You may not require Get item and Get user profile actions in your flow.
Try passing Person field Email output from trigger outputs directly in update item action.
Also, as I and RobElliott mentioned in our above responses, this might lead to infinite flow run loop as you are using update item action inside flow which triggers on item creation as well as item update.
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.
- Femke11Jun 14, 2023Copper Contributor
This works (passing Person field Email output from trigger outputs directly in update item action):
Thanks again both of you!
- ganeshsanapJun 14, 2023MVP
Femke11 Try using flow like given below instead of using trigger condition and one extra column (Status column):
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.
- Femke11Jun 14, 2023Copper Contributor
Thank you for this additional information! I will try to test it with your suggestion to pass the Person field Email output from trigger outputs directly in update item action. Have to figure out how 🙂
In the meantime, I've tried to prevent an infinite loop with a trigger condition. Will this work? I have set a trigger condition in the trigger (on column 'Status' certain value) and in 'update item' I change the status column to a different value:
- ganeshsanapJun 14, 2023MVP
Femke11 This will work initially on item creation (or until the status = Get name and email).
Flow will run and the status will be changed to "Done".
Is there a chance users will change the value of person or group column after that? If yes, email and name columns might not be updated in this case as flow will not run again due to trigger condition.
Please consider giving a Like if my post helped you in any way.
- RobElliottJun 14, 2023Silver ContributorCareful, that's going to end up with the infinite loop; the flow will trigger constantly.