How to Save Power Apps Current User and Manager Name in SharePoint Person Column?

Recently, I was working on a Power Apps requirement and faced a challenging issue saving the Power Apps current user and manager name in the SharePoint Person column.

The strange part is that when we submit a Power Apps form, we can’t directly save the Power Apps current user and manager name [Combo box values] in a SharePoint Person field.

After researching many articles, I found the trickiest solution and implemented it in the Update property of the specific Combo box Data card. And it works really well.

Let’s start it step by step on how to achieve it.

Setup a SharePoint List

Below is a SharePoint list [Traveller Details] with these many columns:

ColumnData type
TitleSingle line of text
Traveler NamePerson or Group
Supervisor NamePerson or Group
Contact NumberNumber
Travel Start DateDate and time
Travel End DateDate and time
Save Power Apps Current User in SharePoint Person Column

Save Power Apps Current User and Manager Name in SharePoint Person Column

The screenshot below represents a Power Apps form [Travel Request]. Both the Person fields [Traveler Name, Supervisor Name] appear with Combo box controls.

Also, both controls are in view mode so that nobody can change/modify them.

Save Power Apps Current User and Manager Name in SharePoint Person Column

Let’s achieve it step by step.

Build Power Apps Form

1. In Power Apps, insert an Edit form and set its DataSource property to the SharePoint list.

DataSource = 'Traveller Details'
Save Power Apps Current User and Manager Name in SharePoint Person Field

2. To display the default current user name (Traveler Name) and Manager name (Supervisor Name), you need to write the codes below on both combo box’s DefaultSelectedItems property:

Traveler Name: DefaultSelectedItems = {DisplayName:User().FullName}
Supervisor Name: DefaultSelectedItems = [Office365Users.ManagerV2(User().Email).displayName]

You need to ensure to connect the Office365Users connector to the app.

Save Power Apps Current User and Manager Name in SharePoint list

3. Add a Button [SUBMIT] and set its OnSelect property as:

OnSelect = SubmitForm(Form1);ResetForm(Form1)

Form1 = Edit form name

Save Power Apps current user and manager in SharePoint Person column

4. Save, Publish, and Preview the app. Fill out the travel request form and click on the SUBMIT.

Save PowerApps current user and manager name in SharePoint Person column

5. Go to the SharePoint list and refresh it once. The strange part is that the current user and manager names are not saved over there. Apart from these two values, all the field values are stored in the SharePoint list, as shown below.

Power Apps save current user name in SharePoint list

Now, how can we overcome this problem? I researched many articles and found the tricky solution below.

We can’t store the Power Apps current user and manager names directly in the SharePoint person field. To store these two values, we must write a code on both combo boxes’ Datacard Update property.

6. Open the Power Apps Edit form -> go to the Update property of Traveler name Data card -> Remove DataCardValue.Selected and apply the code below:

Update = {
    Claims: "i:0#.f|membership|" & User().Email,
    Department: "",
    DisplayName: "",
    Email: "",
    JobTitle: "",
    Picture: ""
}
Power Apps save current user name in SharePoint person column

7. Similarly, go to the Supervisor Name Datacard’s Update property -> Remove DataCardValue.Selected and add the code below:

Update = {
    DisplayName: Office365Users.ManagerV2(User().Email).displayName,
    Claims: "i:0#.f|membership|" & Office365Users.ManagerV2(User().Email).userPrincipalName,
    Department: "",
    Email: Office365Users.ManagerV2(User().Email).userPrincipalName,
    JobTitle: "",
    Picture: ""
}
power apps save current user and manager in SharePoint person column

8. That’s it to do. Save, publish, and close the app. Play the app and submit a new travel request using the form.

Once you refresh the SharePoint list, you can see that the person field values have been updated, as shown below.

powerapps save current user in SharePoint person column

This way, we can save the Power App’s current user and Manager name in the SharePoint Person column.

Some more Power Apps articles you may also like:

>