cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
pvanolinda
Level: Powered On

Problem with Manager field in staff directory

I've been working on a staff directory using Azure AD to populate each person's display name, job title, email address, dept, staff photo, and manager. The only field I'm having trouble with is the manager. I've used this formula:  

 

"Manager: " & If(!IsBlank(ThisItem.Id),Office365Users.Manager(ThisItem.Id).DisplayName)

 

An error comes up for anyone without a manager listed, stating:

manager_error.png

Does anyone know of a way around this as a red bar along the top of the app also shows up at run-time, which is super-annoying!

 

Any help would be greatly appreciated.

Thanks,

Pete

3 REPLIES 3
Community Support Team
Community Support Team

Re: Problem with Manager field in staff directory

Hi @pvanolinda ,

 

This is because that instead of ThisItem.Id, this part should be the user's email address. 

Office365Users.Manager(yourName@yourCompany.com).DisplayName

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
pvanolinda
Level: Powered On

Re: Problem with Manager field in staff directory

Thanks for your reply! Unfortunately, I don't think that's it because I need to forumula to pull back the manager's name dynamically, based on each item in the gallery. It works fine for users with a manager listed in Azure AD, but it throws that error for anyone that doesn't, which leads to a red bar coming up along the top of the app at run-time.

SergioGiusti
Level: Powered On

Re: Problem with Manager field in staff directory

Change 

 

"Manager: " & If(!IsBlank(ThisItem.Id),Office365Users.Manager(ThisItem.Id).DisplayName)

 

To this if it should be picking up the connected users manager

 

"Manager: " & If(!IsBlank(ThisItem.Id),Office365Users.Manager(User().Email).DisplayName) 

 

OR if your getting items (a person to lookup the manaer of) from a gallery/collection

 

"Manager: " & If(!IsBlank(ThisItem.Id),Office365Users.Manager(GalleryNameORCollectionName.Selected.PersonField.Mail).DisplayName)

 

** Disclaimer Smiley Happy

The bit i have put for the gallery is a guess at what data you have in your gallery, you will need to adapt to your actual data.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 27 members 4,233 guests
Please welcome our newest community members: