cancel
Showing results for 
Search instead for 
Did you mean: 

Error handling inside PowerApps (Try-Catch)

My idea come with error message that is being thrown when trying to get manager of user via Office365 Users connector. More details here - https://powerusers.microsoft.com/t5/General-Discussion/Office-365-Users-ManagerV2-Error/m-p/119173.

 

As this is expected error that will be delivered by this connector it will be nice to have some option inside PowerApps to catch it and instead of displaying this for user of PA as "nothing to say" message, to diplay something like no manager found and this can lead to some other actions ...

P.

Status: Under Review

Sorry, I meant to add this as under review. It has been on our radar to improve this experience. Adding @SameerCh to comment on roadmap.

 

Thank you for your patience,

Audrie

Comments
Level: Powered On

After many attempts testing different controls, i have found below formula to be successful for me and is no longer spitting out the error if a user(that has no manager) uses the app.

 

I have tried IfError, IsBlank Not(IsBlank) and all these failed.


The only one that is working for me is IsEmpty.

 

If(IsEmpty(Office365Users.Manager(_myProfile.Id)), Set(_defaultApprover, Blank()), Set(_defaultApprover, Office365Users.Manager(_myProfile.Id)))

 

I created a label to display the information of _defaultApprover to show as "No Manager" when _defaultApprover is blank and it does show it as expected and of course users with manager will display their manager name on it.

Level: Powered On

Yeah everything that worked for me before must have been cached or something because nothing is working for me today.  So frustrating thought I had it working.  Just getting errors.  I will try your idea@isri_zainal

Level: Powered On

Nothing is working for me today that was working previously. Back to square one. So frustrating.  Come on Microsoft this is obvious stuff.

Level: Powered On

Hello All,
I've had it working using this.

I set up a couple of On Load variables:
//Define the request
Set(     varRequester,     Text(Office365Users.MyProfileV2().mail) );
//Define the Manager, and use 'Alternate.Email@msflow.com' if no manager Set(     varApprover,     IfError(         Office365Users.ManagerV2(varRequester).mail,         "Alternate.Email@msflow.com",         Office365Users.ManagerV2(varRequester).mail     ) )
The IfError function is new and experimental, so I had to switch on 'Formula-level error management':
ExperimentalFeature.png
Thanks
Laurence