web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Prefill a person field...
Power Apps
Answered

Prefill a person field with manager of logged in user

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

 

I am new to Power Apps and with my first Project I want to make Life a little easier for my user.

So when the User inherits a specific role a person field should be filled with his data. This works perfectly:

 

 

If(
 Office365Users.MyProfile().JobTitle = "Role" And frm1.Mode = FormMode.Edit,
 {
 DisplayName: User().FullName,
 Claims: "i:0#.f|membership|" & User().Email
 },
 Parent.Default
)

 

 

 

Now a person field should be prefilled with his or her manager. Also the manager of the manager should be prefilled within another person field. What I did until now is the following on DefaultSelectedItems: 

 

 

 

If(
 Office365Users.MyProfile().JobTitle = "Role" And frm1.Mode = FormMode.Edit,
{DisplayName: Office365Users.Manager(Office365Users.MyProfile().UserPrincipalName).DisplayName},
 Parent.Default
)

 

 

 

and this works, the person field is actually pre-filled with the Managers Name BUT when I submit the data to SharePoint nothing is passed. The field stays blank. It only works if the user manually fills out the person field in the form. 

For the managers manager its the following: 

 

 

 

If(Office365Users.MyProfile().JobTitle = "Role" And frm1.Mode = FormMode.Edit, 
 {
 DisplayName: Office365Users.Manager(Office365Users.Manager(Office365Users.MyProfile().Mail).Mail).DisplayName

 },
 Parent.Default)

 

 

 

same problem over here: the field is correctly filled out but no data is passed to sharepoint when submitted. The user always has to manually confirm the auto filled data. 

 

 

Anyone can help? Thanks in advance

Categories:
I have the same question (0)
  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    The values of Person column in SharePoint lists are actually records with multiple columns:

     

    {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Claims:"i:0#.f|membership|"& Email,
     Department:"",
     DisplayName:"DisplayName",
     Email:"Email",
     JobTitle:"",
     Picture:""
    }
    

     

     

    So, on your end, you need to use this syntax of record:

     

    If(
     Office365Users.MyProfile().JobTitle = "Role" And frm1.Mode = FormMode.Edit,
     {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Claims:"i:0#.f|membership|"& Office365Users.Manager(Office365Users.MyProfile().Mail).Mail,
     Department:"",
     DisplayName: Office365Users.Manager(Office365Users.MyProfile().Mail).DisplayName,
     Email: Office365Users.Manager(Office365Users.MyProfile().Mail).Mail,
     JobTitle:"",
     Picture:""
     },
     Parent.Default
    )

     

     

    Another method is using LookUp function to find this record, evaluating using DisplayName field or Email field:

     

    If(
     Office365Users.MyProfile().JobTitle = "Role" And frm1.Mode = FormMode.Edit,
     LookUp(
     Choice(
     SPlist.PersonColumn
     ),
     DisplayName = Office365Users.Manager(Office365Users.MyProfile().Mail).DisplayName
     ),
     Parent.Default
    )

     

     

    Please have a try and hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Since I implemented this feature I cant update my List.

    It worked before but since I was cleaning all the old test records from my sharepoint list every time I try to submit a new record to sharepoint it says: badgateway

    when i reset defaultselecteditems to default the error is gone... what could be the reason? Is there a workaround?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 345 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 177

Last 30 days Overall leaderboard