web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Error handling for nul...
Power Apps
Answered

Error handling for null values

(0) ShareShare
ReportReport
Posted on by 185

Hi all,

 

I am using the Office365Usersa connector to lookup a particular users manager. It works fine if the user has an assigned manager but throws an error when manger is null (or in the case of the combo box when i clear the current user and searching for another).

 

When my combobox is empty:

da1vea_1-1704678694924.png

 

When my combobox has a a selected user where manager is null:

da1vea_2-1704678728962.png

 

The expression i am using to get the manager is:

Office365Users.ManagerV2(userSelect.Selected.UserPrincipalName).displayName

userSelect = combobox

 

I have been trying things like:

If(
 !IsBlank(Office365Users.ManagerV2(userSelect.Selected.UserPrincipalName)),
 Coalesce(Office365Users.ManagerV2(userSelect.Selected.UserPrincipalName).displayName, Blank()),
 Blank()
)
If(
 !IsBlank(Office365Users.ManagerV2(userSelect.Selected.UserPrincipalName)),
 Office365Users.ManagerV2(userSelect.Selected.UserPrincipalName).displayName,
 "No Manager"
)
If(
 !IsBlank(userSelect.Selected.UserPrincipalName),
 If(
 !IsEmpty(Errors(Office365Users.ManagerV2(userSelect.Selected.UserPrincipalName))),
 Office365Users.ManagerV2(userSelect.Selected.UserPrincipalName).displayName,
 "No Manager"
 ),
 "Invalid User"
)
If(
 !IsBlank(Office365Users.ManagerV2(userSelect.Selected.UserPrincipalName).displayName),
 Office365Users.ManagerV2(userSelect.Selected.UserPrincipalName).displayName,
 Blank()
)

 

Any guidance how i can ignore that error? I have turned on Formula level error management

 

Thanks,
David

Categories:
I have the same question (0)
  • Verified answer
    v-yueyun-msft Profile Picture
    on at

    Hi , @da1vea 

    You can try to use this code :

    If(userSelect.Selected.UserPrincipalName=Blank() || IsEmpty(userSelect.SelectedItems) , Blank(), 
    IfError( Office365Users.ManagerV2(userSelect.Selected.UserPrincipalName).displayName , Blank() , Office365Users.ManagerV2(userSelect.Selected.UserPrincipalName).displayName )
     )

     

    If this reply can help you , you can click mark this reply as solution, thanks in advance!


    Best Regards,

    Yueyun Zhang

  • da1vea Profile Picture
    185 on at

    Hi @v-yueyun-msft  - thank you. This is working perfectly

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard