Forum Discussion
AthabascanDave
Apr 29, 2022Copper Contributor
Auto-populate SharePoint columns with profile information
This has been asked previously but some of the information seems stale due to O365 changes, or just hasn't worked for me. The short version is I have a SharePoint list with the person or group c...
- 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
RobElliott
Apr 30, 2022Silver Contributor
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
May 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!