Forum Discussion
Auto-populate SharePoint columns with profile information
- Apr 30, 2022
AthabascanDave don't rely on templates, you can build a very simple flow from blank to do this. The overall flow looks like this and we'll look at the trigger and each of the 2 actions later:
In the SharePoint list there is a person column called Employee and the Title column where the employee's name or account name can be stored. I've also added single line of text columns for position, department and mobile phone number. Those last 3 are what will be auto-populated.
For the SharePoint form you can remove those 3 columns as you won't be entering that data manually. This will leave just the person column and the title column:
So a new item is created, the flow will run and the 3 other columns will be populated with the employee's info:
The flow has a SharePoint trigger of "When an item is created" and you select the site and the list:
Next, add an Office 365 Users "Get user profile (v2)" action and for the User (UPN) field, click in the field and select Employee Email from the dynamic content box that appears:
Finally, add a SharePoint "Update item" action. Again, select your site and list and in the ID field select ID from the when an item is created section of the dynamic content box.
Scroll down through the dynamic contents box and you'll see the employee's information is available to be selected from the Get user profile (v2) section of the dynamic content box:
Rob
Los Gallardos
Microsoft Power Automate Community Super User
AthabascanDave don't rely on templates, you can build a very simple flow from blank to do this. The overall flow looks like this and we'll look at the trigger and each of the 2 actions later:
In the SharePoint list there is a person column called Employee and the Title column where the employee's name or account name can be stored. I've also added single line of text columns for position, department and mobile phone number. Those last 3 are what will be auto-populated.
For the SharePoint form you can remove those 3 columns as you won't be entering that data manually. This will leave just the person column and the title column:
So a new item is created, the flow will run and the 3 other columns will be populated with the employee's info:
The flow has a SharePoint trigger of "When an item is created" and you select the site and the list:
Next, add an Office 365 Users "Get user profile (v2)" action and for the User (UPN) field, click in the field and select Employee Email from the dynamic content box that appears:
Finally, add a SharePoint "Update item" action. Again, select your site and list and in the ID field select ID from the when an item is created section of the dynamic content box.
Scroll down through the dynamic contents box and you'll see the employee's information is available to be selected from the Get user profile (v2) section of the dynamic content box:
Rob
Los Gallardos
Microsoft Power Automate Community Super User
- ulmoshareDec 16, 2022Brass ContributorThanks Rob for this solution. I have one more question. If I use the module "when an item is created or modified" instead of "when an item is created", then I run in a loop. How can I tell the flow to only run once for the selected record in the list? If I add a trigger
@equals(triggerBody()?['MA'],'')
then it doesn't work either. Is there a solution for my question with Power Automate? Or does the solution only work new records? - JMMcDAug 09, 2022Copper Contributor
Preface that I am not an experienced user in Power Automate. I tried to follow your steps, but ran into an error.
The specified user Office of the Exec Vice Chancellor UNL could not be found.
clientRequestId: 96d61e56-3482-4c55-8fe3-5c5ab9dc327a
serviceRequestId: 96d61e56-3482-4c55-8fe3-5c5ab9dc327aIt pulled the correct department as "Office of the Exec Vice Chancellor UNL" is the right department for that user, but I received that error and the flow failed. My employee column is called Person. It is a person column. I want the user to input a name in the person column, then PA to update other profile information (like department).
Thank you!
- AthabascanDaveMay 02, 2022Copper Contributor
User not found error. Clearly I am calling the department successfully (cloud business office) but the flow throws the error and stalls out before updating the list. I've tried adding intermediary stages or blowing out/rebuilding the list but haven't had any luck.
Here's my flow:
Here's the error:
Full error text from the body:
{"error": {"code": "ResourceNotFound","message": "User not found","innerError": {"date": "2022-05-02T16:59:32","request-id": "7a31d902-be64-43ec-9d2c-52b65fc9f25f","client-request-id": "7a31d902-be64-43ec-9d2c-52b65fc9f25f"}}}- RobElliottMay 02, 2022Silver Contributor
AthabascanDave your get user profile UPN looks wrong to me as it seems to be looking for a department not a user. Look at what I had in my example.
Rob
Los Gallardos
Microsoft Power Automate Community Super User- AthabascanDaveMay 02, 2022Copper ContributorAh hah. Okay so my UPN was set to 'Attendee Department' because I misread the point of that step. I changed it to "Attendee Email" and it now works. Thank you so much!
- AthabascanDaveMay 02, 2022Copper ContributorThanks Rob I'll get to work on putting this together and follow up if I have questions.