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

IsError function

I have the following formulas:

Set(_defaultApprover;Office365Users.Manager(_myProfile.Id));;
Set(_defaultApproverPhoto; If(Office365Users.UserPhotoMetadata(_defaultApprover.Id).HasPhoto; Office365Users.UserPhoto(_defaultApprover.Id)));;

But some of my O365 users doesnt have managers in his profile and they got errors. If they havent a manager i want that they approve themselves.

So i set the following formulas:

If(
    IsError(Office365Users.Manager(_myProfile.Id))
    ;
    Set(_defaultApprover; _myProfile)
    ;
        Set(_defaultApprover;Office365Users.Manager(_myProfile.Id))&&
        Set(_defaultApproverPhoto; If(Office365Users.UserPhotoMetadata(_defaultApprover.Id).HasPhoto; Office365Users.UserPhoto(_defaultApprover.Id)))
    );;


But the people without a manager still get the errors. How can i fix that? 

The errors are: Office365.User.Manager failed {Status;404 cant find manager}
& Office365.Users.UserPhotoMetadata failed Unvalid value for parameter UserID






3 REPLIES 3
KroonOfficeSol
Level 10

Re: IsError function

@Oos

 

I think you use the IsError() formula in the wrong way here. Just take a peak at it and it says it give a fallback value on an error. So you could try this

 Set(_defaultApprover;IsError(Office365Users.Manager(_myProfile.Id);""))

Or else try

 Set(_defaultApprover;If(IsBlank(Office365Users.Manager(_myProfile.Id));Office365Users.Manager(_myProfile.Id);""))

Hope this helps.


Paul

 

 

 

 

Highlighted
Oos
Level: Powered On

Re: IsError function

It works but i am still getting the red error. Thanks

KroonOfficeSol
Level 10

Re: IsError function

@Oos

 

Did it now work or not?

 

If not, then try to change your VariableName, it could be that this one is set somewhere else in your app to another datatype. This could make the red flags on mismatching datatypes.

 

btw sometime you see more information when you click away from the control and only hover the red flag. I know this is strange, but still this is the case.

 

Hope this helps you to resolve this.

 

Paul 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

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

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 50 members 4,905 guests
Please welcome our newest community members: