I have this in the Text property of a text box:
If(
IsEmpty(Office365Users.SearchUser({searchTerm: name4.Text})),
"techsuppliermanagement@gmail.com",
ThisItem.Mail
)
However, the text wouldn't show up even if IsEmpty(Office365Users.SearchUser({searchTerm: name4.Text})) evaluates to true or false. It keeps saying that error. How do I fix this syntax?
Thank you!
Solved! Go to Solution.
Hi @Anonymous ,
Firstly, for the Office365Users.SearchUserV2() function, you should use the following formula to reference the mail value:
First(Office365Users.SearchUserV2({searchTerm: name4.Text}).value).Mail
so you could try the following formula:
If(
IsBlank(First(Office365Users.SearchUserV2({searchTerm: name4.Text}).value).Mail),
"techsuppliermanagement@gmail.com",
First(Office365Users.SearchUserV2({searchTerm: name4.Text}).value).Mail
)
Have you applied your formula within the Default property of a Text Input box, same issue occurs? The text value would not be shown up in your published app?
Please consider remove the Office 365 Users connection, then re-create a new connection to your Office 365 Users connector from your PowerApps, try the formula again in your app, check if the issue is fixed.
Also please consider turn on the "Formula-level error management" option within Advanced settings of Apps settings of your app, then re-publish your canvas app, check if the issue still exists.
Regards,
@Anonymous
You can grab the first result from SearchUserV2 and display it in the Text property of a label like this:
With(
{UserMail: First(Office365Users.SearchUserV2({searchTerm: name4.Text})).Mail},
If(IsBlank(UserMail), "techsuppliermanagement@gmail.com", UserMail)
)
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
Hi @Anonymous ,
Firstly, the "This formula uses scope, which is not presently supported for evaluation" prompt message is not an error, it is just a prompt message from the Formula Bar Intelligence.
Could you please share a bit more about your app's configuration? Do you add the Label inside a Gallery, and want to display the email value inside your Gallery?
The Office365Users.SearchUser() formula returns a Record value rather than Table value, if you want to check if the Office365Users.SearchUser() formula result is Blank, you should use the IsBlank() function. The screenshot as below:
Please modify your formula as below:
If(
IsBlank(Office365Users.SearchUser({searchTerm: name4.Text})),
"techsuppliermanagement@gmail.com",
ThisItem.Mail
)
If you want to display the value inside a Label , please set the Text property to above formula. If you want to display the value inside a Text Input Box, please set the Default property of the Text Input box to above formula.
Also please make sure the ThisItem.Mail formula could return a proper value. If you want to display corresponding email address based on the specific display name, please consider modify above formula as below:
If(
IsBlank(Office365Users.SearchUser({searchTerm: name4.Text})),
"techsuppliermanagement@gmail.com",
Office365Users.SearchUser({searchTerm: name4.Text}).Mail // Modify formula here
)
or
If(
IsBlank(LookUp(Office365Users.SearchUser(), name4.Text in DisplayName)),
"techsuppliermanagement@gmail.com",
LookUp(Office365Users.SearchUser(), name4.Text in DisplayName).Mail
)
Please consider take a try with above solution, check if the issue is solved.
Best regards,
@v-xida-msft
SearchUser is deprecated and should not be used because it could be deleted by Microsoft in the future. Instead the poster should use SearchUserV2 instead.
This will produce an incorrect result. The SearchUser function returns a table which means IsBlank will always be false.
IsBlank(Office365Users.SearchUser({searchTerm: name4.Text})),
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
I tried using your formula and it showed the correct email. However, when I clicked onto the Play Mode, the text disappears. I can only see it when I'm editing. The Display mode of this item is "Edit", so I should still be able to see it. Sometimes, the correct text even glitch between the wrong solution and the right solution. I'm wondering why this had happened?
Hi @Anonymous ,
Firstly, for the Office365Users.SearchUserV2() function, you should use the following formula to reference the mail value:
First(Office365Users.SearchUserV2({searchTerm: name4.Text}).value).Mail
so you could try the following formula:
If(
IsBlank(First(Office365Users.SearchUserV2({searchTerm: name4.Text}).value).Mail),
"techsuppliermanagement@gmail.com",
First(Office365Users.SearchUserV2({searchTerm: name4.Text}).value).Mail
)
Have you applied your formula within the Default property of a Text Input box, same issue occurs? The text value would not be shown up in your published app?
Please consider remove the Office 365 Users connection, then re-create a new connection to your Office 365 Users connector from your PowerApps, try the formula again in your app, check if the issue is fixed.
Also please consider turn on the "Formula-level error management" option within Advanced settings of Apps settings of your app, then re-publish your canvas app, check if the issue still exists.
Regards,
User | Count |
---|---|
260 | |
123 | |
99 | |
48 | |
43 |