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

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