Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Setting variable to User().Email resulting in blank

(0) ShareShare
ReportReport
Posted on by 130

Hello!

In my standalone app, I have a dropdown that I only want visible to our team's groups. I have done this successfully for a button on another app using Microsoft Entra ID (Azure AD) and the CheckMembersGroupsV2 function. Since I was using the exact same groups, I just copy and pasted the formula from one app to my current app. The formula is set on the App's OnStart property as follows: 

If(!IsEmpty(MicrosoftEntraID.CheckMemberGroupsV2(User().Email,["Group1 Object ID"]).value), Set(varGroup1, true), Set(varGroup1, false));
If(!IsEmpty(MicrosoftEntraID.CheckMemberGroupsV2(User().Email,["Group2 Object ID"]).value), Set(varGroup2, true), Set(varGroup2, false))

then I set the Visible property for the dropdown to "varGroup1 Or varGroup2". This made the dropdown invisible, so I checked to see if the variables were being set to my email and also to true, instead, all I see is blank.

 

I had previously achieved this functionality with the button with a different formula, so I also tried that one:

Set(varUserEmail,User().Email);Set(varGroup1,!IsBlank(MicrosoftEntraID.CheckMemberGroupsV2(varUserEmail,["Group1 Object ID"]))) Or Set(varGroup2,!IsBlank(MicrosoftEntraID.CheckMemberGroupsV2(varUserEmail,["Group2 Object ID"])))

and this one also comes up as blank for each variable.

LS579_1-1713460444174.png

Can anyone tell me why this is working for a button and not a dropdown? Or what I am doing wrong / another way to achieve this functionality?

 

TIA!

 

 

 

Categories:
  • LS579 Profile Picture
    130 on at
    Re: Setting variable to User().Email resulting in blank

    Oh my gosh! I completely forgot about that step!!! I can't believe it!

    Thank you so much for answering my question even though it was such an oversight on my part!

  • Verified answer
    v-yueyun-msft Profile Picture
    on at
    Re: Setting variable to User().Email resulting in blank

    Hi , @LS579 

    Where do you put this code in your Power App. If you put the code in the App- OnStart. You need to click "Run on start" to test.

    vyueyunmsft_0-1713490300702.png

     

    Best Regards,

    Yueyun Zhang

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard