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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / get selected user mana...
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:
I have the same question (0)
  • mdevaney Profile Picture
    29,989 Moderator on at

    @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."

  • EP-29071004-0 Profile Picture
    on at

    @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,989 Moderator on at

    @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

    @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

     

  • Verified answer
    v-yutliu-msft Profile Picture
    on at

    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

     @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.

  • kmw1130 Profile Picture
    988 on at

    @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

     

  • dmclaughlin Profile Picture
    347 on at

    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?

  • EP-29071004-0 Profile Picture
    on at

    Hi @dmclaughlin ,

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

    hope it will help.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard