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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Make visible a button ...
Power Apps
Unanswered

Make visible a button only if Office365User.MyProfileV2() is in Name column of a Dataverse table

(0) ShareShare
ReportReport
Posted on by 802

Hi all, 

 

I have a button which I only want displayed if the User (from the O365 connector) is on a "PrivilegedUsers" Dataverse table, in it's Name column. 

 

Does anyone have any code of how I do this?  I am thinking something like If(LookUp..... and then I'm lost...

 

Thanks

K.

Categories:
  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    Email column is better suited for this since emails will be unique:

    App.OnStart:

    Set(varEmail,Office365User.MyProfileV2().Mail);

    Set(IsUser,LookUp(Table,Email=varEmail));

     

    On Button visible property:

    !IsBlank(IsUser)

     

    this code will check the table if currently logged in user is in the list. If he is there it will store that record in the variable. ON the button visible it will only show button if that variable is not blank

  • Kosenurm Profile Picture
    802 on at

    Thank you so much. 

     

    There is another button where it should be displayed for all, but only selectable for those in the varEmail variable. How would this work?

     

    Thanks

    K.

  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    Button DisplayMode property:

    If(IsBlank(varEmail),DisplayMode.Disable,DisplayMode.Edit)

  • Kosenurm Profile Picture
    802 on at

    Thanks, but that is generating an error - "The function If has some invalid arguments" ??

  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    You need to write this code on button DisplayMode property. It won't work on anywhere else. Show pictures

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard