Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

get selected user manager name

(1) ShareShare
ReportReport
Posted on by

Hi,

i have a SPO list in which i hjave two Person fields, in the first field the user should type in a name.

i want the other field to be auytomatically populated with the manager name.

i tried this formula in the item property: 

Office365Users.Manager(DataCardValue10_1.Selected.Email).DisplayName

im getting following error:

Perez_0-1599467235202.png

i tried both Manager and manager v2 functions.

 

any idea, what im doing wrong?

 

if any information missing will provide it gladly.

 

Categories:
  • EP-29071004-0 Profile Picture
    on at
    Re: get selected user manager name

    Hi @dmclaughlin ,

    please refer to @v-yutliu-msft answer, it solved it for me, also marked as accepted solution.

    hope it will help.

  • dmclaughlin Profile Picture
    347 on at
    Re: get selected user manager name

    I'm having this same issue.  Did you ever get it to work to pull in the manager of someone based on that someone being a person field in the app?

  • kmw1130 Profile Picture
    930 on at
    Re: get selected user manager name

    @v-yutliu-msft  My field was working properly until recently.  I am doing basically the same thing, but I'm getting an error

     

    {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
    Claims:"i:0#.f|membership|" & Office365Users.ManagerV2(DataCardValue21.Selected.Email).mail,
    Department:"",
    DisplayName:Office365Users.ManagerV2(DataCardValue21.Selected.Email).displayName,
    Email:Office365Users.ManagerV2(DataCardValue21.Selected.Email).mail,
    JobTitle:"",
    Picture:""
    }

    kmw1130_0-1643676534829.png

    kmw1130_1-1643676568527.png

     

  • EP-29071004-0 Profile Picture
    on at
    Re: get selected user manager name

     @v-yutliu-msft .

    thanks a lot for your help it worked well!!!

    i defined the GL, PM, and LM as varibles on the onselect of the Employee field and than used your formula in the defaultselecteditems field.

  • Verified answer
    v-yutliu-msft Profile Picture
    on at
    Re: get selected user manager name

    Hi @Perez ,

    Do you mean that you have 4 person fields?

    Do you want to automatically populate GL based on selected user for Employee, then automatically populate PM based on selected user for GL (LM-->PM-->GL--> Employee)?
    Could you tell me the combo boxes' Items:
    Usually, the person field combo box's Items look like this:

    Choices(listname.fieldname)

    If so, please do not set combo box's DefaultSelectedItems directly about Office365Users.Manager function.

    You need to make set combo box's DefaultSelectedItems based on person field's data structure.

    Please set combo box's DefaultSelectedItems like this:

    {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Claims:"i:0#.f|membership|" & Office365Users.ManagerV2(DataCardValue10_1.Selected.Email).mail,
     Department:"",
     DisplayName:Office365Users.ManagerV2(DataCardValue10_1.Selected.Email).displayName,
     Email:Office365Users.ManagerV2(DataCardValue10_1.Selected.Email).mail,
     JobTitle:"",
     Picture:""
     }

     

     

    Best regards,

  • EP-29071004-0 Profile Picture
    on at
    Re: get selected user manager name

    @mdevaney ,

    sorry for the abrevations 🙂

    its just Group leader, project manager and line manager, using the formula i want to get the employee manager (GL|) and then the GL manager (PM) and so on, LM-->PM-->GL--> Employee.

     

    i tried the formula you suggested, the error was disapeared but the default values are not presented

    Perez_0-1599505376110.png

     

  • mdevaney Profile Picture
    29,987 Super User 2025 Season 1 on at
    Re: get selected user manager name

    @Perez 
    OK, now that I understand your app I must ask: what field would you like the manager to be in?  I do not know what GL, PM, LM mean.

     

    Let's assume you would like the Manager to appear in the PM field.  To do it you would simply include this code in the Default property of the PM Combobox.

    Office365Users.ManagerV2(DataCardValue10_1.Selected.Email)

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

  • EP-29071004-0 Profile Picture
    on at
    Re: get selected user manager name

    @mdevaney 

    thanks for your reply.
    my use case is that the user type in the app the employee name and i want the GL, PM and LM, names to be automatically retrieved.

    Perez_0-1599489389652.png

    in the sharepoint list it is all person fields.

    if additional data required, i will be happy to provide.

  • mdevaney Profile Picture
    29,987 Super User 2025 Season 1 on at
    Re: get selected user manager name

    @Perez 

    Your code is correct.  

    Office365Users.ManagerV2(DataCardValue10_1.Selected.Email).DisplayName

     

    The issue where you are typing it.  Did you notice how the error 'Expected Record Value' appeared?  You must be typing it inside a field that expects a record, not a name. For instance this would produce a record.

     

    Office365Users.ManagerV2(DataCardValue10_1.Selected.Email)

     

    If you need further help please tell me what type of control is being used and what property you are typing inside.  A screenshot of the app would be super beneficial too.

     

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,552 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,928 Most Valuable Professional

Leaderboard