cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gazzo1967
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
SimonPiquer
Continued Contributor
Continued Contributor

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

7 REPLIES 7
SimonPiquer
Continued Contributor
Continued Contributor

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)

gazzo1967
Impactful Individual
Impactful Individual

@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

SimonPiquer
Continued Contributor
Continued Contributor

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.

gazzo1967
Impactful Individual
Impactful Individual

@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

cvazquc3
Helper I
Helper I

To me if the correct data appears, in each item of the gallery your manager But I think it is a critical problem, since it increases the number of errors or warnings according to the number of items in the gallery.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (2,989)