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

How to handle an empty collection

I am using the Org Browser sample app and am running into a problem.

When you navigate through the org chart and reach the top (The Big Boss) This error appears:

 

Office365Users.Manager failed: { "status": 404, "message": "No manager found for the specified user.\r\nclientRequestId: a270075b-3cb3-4c77-a968-22140088cc77", "source": "office365users-cus.azconn-cus.p.azurewebsites.net" }

 

The Manager field for the user is empty.

How can I catch this so it doesn't show the error?

I've tried IsError, IsEmpty(Manager), IsBlank, and Hari Kari.

 

ClearCollect(Employee, Manager);
IfError(If(!IsEmpty(Manager),ClearCollect(Manager, Office365Users.Manager(First(Employee).Id))),"");
Navigate(OrganizationScreen, Fade)

 

ClearCollect(Employee, Manager);
If(!IsEmpty(Manager),ClearCollect(Manager, Office365Users.Manager(First(Employee).Id)),"");
Navigate(OrganizationScreen, Fade)

 

None of which work.

 

Please help.

Thanks

Ron

3 REPLIES 3
Community Support Team
Community Support Team

Re: How to handle an empty collection

Hi @Capt_Ron,

 

This seems to be the limitation of the Office365Users Connection. If there is no Manager for the corresponding user ID, then the Office365Users.Manager() function would throw the error.

 

You could refer to below thread as the temporary workaround:

https://powerusers.microsoft.com/t5/General-Discussion/Office365Users-Manager-throws-error-when-CEO-...

 

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.
Capt_Ron
Level: Powered On

Re: How to handle an empty collection

Mona,

Thank you.

The work around was posted over a year ago.  No movement on this?

How come I can't trap the error?  If I could trap the error, I could substitute the field or hide it.

Ron

mackaaij
Level: Powered On

Re: How to handle an empty collection

I got it to work and posted my solution over here.

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (4,619)