Showing results for 
Search instead for 
Did you mean: 
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:


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.



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. 




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

Level: Powered On

Re: Problem with Manager field in staff directory



"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


Watch Sessions On Demand!

Continue your learning in our online communities.


Follow PowerApps on Twitter

Stay Up-to-Date by following PowerApps on Twitter

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


Power Platform World Tour

Coming to a city near you


PowerApps Community User Group Member Badge

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


Join PowerApps User Group!!

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


Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Users Online
Currently online: 81 members 3,886 guests
Please welcome our newest community members: