We pointed a sample/demo Org Chart app at our AzureAD, and the first thing that happened was they put in the CEO's name, and it gave an error:
The service returned an error: Office365Users!Manager: {"status":404,"message":"No manager found for the specified user.","source":"127.0.0.1"}
This is because the CEO has no manager, of course.
I tried an if statement to see if a value was returned...
The conditional works fine (it returns True when there is no manager, False when there is not)
IsBlank(Office365Users.Manager(First(Manager).Id))
But still throws the error. In other words, simply testing to see if there is a Manager throws the error. It seems kind of strange that it's not possible for there to be a null value in a field without an error being generated. Especially when the demo/template app has stuff like "Visible; CountRows(Manager) > 0" which seems to indicate the form is designed to be able to handle people without a Manager.
Anyone have any ideas on how to fix this systemically (as opposed to writing IF logic based on something like a specific job title, which works, but won't adapt to job title changes, etc.)?
Solved! Go to Solution.
Hi @marcosa-ca,
Thanks for the feedback.
This seems to be the limitation of the Office365Users Connection (or saying the service).
If there is no Manager for the corresponding user ID, then the Office365Users.Manager() function would throw the error.
For the Job Title, please consider change the formula with the following:
If(First(Manager).JobTitle<>"CEO",
Office365Users.Manager(First(Manager).Id).DisplayName,
"This is CEO")
For JobTitle Changes, we may create a single record table , then use filter function to check,
You can also define a single-column table with square brackets. An equivalent way to write the above:
[ "Strawberry", "Vanilla" ]
for example:
If( IsEmpty( Filter(["IT","Work", "CEO"], Office365Users.MyProfile().JobTitle in ["IT","Work", "CEO"]) ), Office365Users.MyProfile().DisplayName, Office365Users.MyProfile().JobTitle)
The formula above would check if the JobTitle is within the value specified in the single column table ["IT","Work","CEO"], if the table returned by the filter is empty, which means the JobTitle doesn't match the value specified, then it will show the the User display Name, otherwise, it will show the JobTitle.
Adding some reference:
Understand tables and records in PowerApps
Hope the information above is helpful.
Regards,
Michael
Hi @marcosa-ca,
Thanks for the feedback.
This seems to be the limitation of the Office365Users Connection (or saying the service).
If there is no Manager for the corresponding user ID, then the Office365Users.Manager() function would throw the error.
For the Job Title, please consider change the formula with the following:
If(First(Manager).JobTitle<>"CEO",
Office365Users.Manager(First(Manager).Id).DisplayName,
"This is CEO")
For JobTitle Changes, we may create a single record table , then use filter function to check,
You can also define a single-column table with square brackets. An equivalent way to write the above:
[ "Strawberry", "Vanilla" ]
for example:
If( IsEmpty( Filter(["IT","Work", "CEO"], Office365Users.MyProfile().JobTitle in ["IT","Work", "CEO"]) ), Office365Users.MyProfile().DisplayName, Office365Users.MyProfile().JobTitle)
The formula above would check if the JobTitle is within the value specified in the single column table ["IT","Work","CEO"], if the table returned by the filter is empty, which means the JobTitle doesn't match the value specified, then it will show the the User display Name, otherwise, it will show the JobTitle.
Adding some reference:
Understand tables and records in PowerApps
Hope the information above is helpful.
Regards,
Michael
Apologies for the delay. Coded around this by using 'exactin' with || (or) rather than <> because there are multiple cases and titles with slight variances that have no supervisor. This worked, but it needs to be staticaly defined (we have to specify the strings to partial match against - if a new job title happens, everything will break), and needs to be done in multiple places - so this is not an ideal solution. However, thank you for confirming that there is no way around this errror message to do it correctly based on the inability of the Office365Users method failing to silently deal with a field being empty - this saved me a lot of second-guessing whether I was using a band-aid if there was a real solution available (but apparently there is not). Thanks so much!!
⚠ Don't panic !
Simple Enable this:
Go to
«Experimental features» section -> Enable «Formula-level error management»
and Use this Formula: IfError(Office365Users.ManagerV2(User().Email).displayName,"");
Was glad to help 😊
User | Count |
---|---|
260 | |
110 | |
97 | |
56 | |
40 |