cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Impactful Individual
Impactful Individual

Return manager name

Hi All

I have a Gallery in which i return user names (person /group field) with the formula (ThisItem.person_1.DisplayName) what i would like to do in a label is return the managers name associated with the user display name. I have linked in the Office365 users connector but when i try
If(Label1.Text = Text(Office365Users.UserProfileV2(DisplayName).DisplayName),Office365Users.ManagerV2(DisplayName).displayName,"No Manager Listed")
I get an error in the red text section

Capture.JPG

 

Is my logic flawed?

regards Gary

1 ACCEPTED SOLUTION

Accepted Solutions

What if you try this for the manager label:

 

If(IsBlank(Office365Users.ManagerV2(ThisItem.person_1.Email).displayName),"No manager listed",Office365Users.ManagerV2(ThisItem.person_1.Email).displayName)

 

Office365Users.ManagerV2(ThisItem.person_1.Email).displayName should show the manager of person_1, my question is what kind of column person_1 is? Otherwise it's hard to know.

View solution in original post

6 REPLIES 6
Responsive Resident
Responsive Resident

Hi Gary,

 

It is a known issue that Office365Users throws a 404 error when a field you're trying to show is empty, see this thread.

 

It should still work for those entries that have data, but I must admit I'm not exactly sure what you want to accomplish.


Based on your description I did a test and the following works for me:


Gallery: Gallery.Items = Office365Users.SearchUserV2().value

 

Users displayname: Label1.Text = ThisItem.DisplayName 

 

Manager name: If(IsBlank(Office365Users.ManagerV2(ThisItem.UserPrincipalName).displayName),"No manager listed",Office365Users.ManagerV2(ThisItem.UserPrincipalName).displayName)

@SimonPiquer 
Thank you for the response

all i am trying to do is in my Gallery i have a username returned (not the person who is logged in) and i want to return their manager.
I have tried you formula and it returns errors
Gallery items = filter on a collection based on date

Label1 = ThisItem.person_1.Displayname
Label to populate = Label1 .Manager


I have tried your formula and edited it with my fields and i receive and error
Invalid arguments

Regards
GAry

What if you try this for the manager label:

 

If(IsBlank(Office365Users.ManagerV2(ThisItem.person_1.Email).displayName),"No manager listed",Office365Users.ManagerV2(ThisItem.person_1.Email).displayName)

 

Office365Users.ManagerV2(ThisItem.person_1.Email).displayName should show the manager of person_1, my question is what kind of column person_1 is? Otherwise it's hard to know.

View solution in original post

@SimonPiquer 
Hi 
the column is a sharepoint person/group column
I return the datat to a Label with ThisItem.person_1.DisplayName
my rationale  was compare Label1 againts user profile displayname and return manager if true  or "No Manager"
(very frustrating 😞 .) is it my logic?
Picture1.png

regards gary

Hi @gazzo1967 ,

This formula is used to : get person_1 field's manager, if he has manager, it will return his manager, if he has no manager, it will return "No manager listed".

If(IsBlank(Office365Users.ManagerV2(ThisItem.person_1.Email).displayName),"No manager listed",Office365Users.ManagerV2(ThisItem.person_1.Email).displayName)

 The result that this formula returns will not compare with the value in label1: "ThisItem.person_1.DisplayName".

If you want to compare, please describe the feather that you want in details.

 

The formula above will indeed return this error "manager does not exists....". However, you do not need to worry about this.

This error will return is because you set the user with no manager in his profile. There's no solution to avoid this error, unless you set every person with manager in this profile. 

Actually, I do not think you need to care about this error, it will not affect your app's performance. 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yutliu-msft 
@SimonPiquer 

 

Thank you both for the response.
i have now found what the issue was and that is my organisation hasn't populated the manager field 😞

So it will always show no manager and an error

thank you very much for you assistance
Simon i will mark your answer as the solution as yougave me the correct answer first 😛
Gary

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (69,912)