cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

ThisItem.Mail said "This formula uses scope, which is not presently supported for evaluation"

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!

1 ACCEPTED SOLUTION

Accepted Solutions

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,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
mdevaney
Super User
Super User

@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."

v-xida-msft
Community Support
Community Support

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:

5.JPG

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,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@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."

Anonymous
Not applicable

@mdevaney 

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,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,536)