cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mistaavi
New Member

How to disable a button based on user

Hello all, I am new to Power Apps and trying to design a Contacts List

I have the + button added in top right corner of app

I want to disable that based on if the user is any one else besides me or any one else I invite as admin

If(DataSourceInfo([@Contacts], DataSourceInfo.CreatePermission), DisplayMode.Edit, DisplayMode.Disabled) is the current code

 

Mistaavi_0-1641753984438.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi @Mistaavi,

Have you solved your problem?

Do you want to check if the current user is admin?

Could you please tell me more about your data source?

 

Actually, the DataSourceInfo.CreatePermission checks if the current user has permission to create records in this data source and it returns true if the current user has permission.

In addition, permissions checking with DataSourceInfo is only possible when using Microsoft Dataverse.

 

So combine with your condition, you could try the following formula:

If(DataSourceInfo([@Contacts], DataSourceInfo.CreatePermission) || 
   User().Mail=Office365Users.MyProfileV2().mail, 
   DisplayMode.Edit, 
   DisplayMode.Disabled
) 

 

Best Regards,
Qi

View solution in original post

2 REPLIES 2
rampprakash
Super User
Super User

Hello @Mistaavi,

 

May i know what's your Back End?

v-qiaqi-msft
Community Support
Community Support

Hi @Mistaavi,

Have you solved your problem?

Do you want to check if the current user is admin?

Could you please tell me more about your data source?

 

Actually, the DataSourceInfo.CreatePermission checks if the current user has permission to create records in this data source and it returns true if the current user has permission.

In addition, permissions checking with DataSourceInfo is only possible when using Microsoft Dataverse.

 

So combine with your condition, you could try the following formula:

If(DataSourceInfo([@Contacts], DataSourceInfo.CreatePermission) || 
   User().Mail=Office365Users.MyProfileV2().mail, 
   DisplayMode.Edit, 
   DisplayMode.Disabled
) 

 

Best Regards,
Qi

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Users online (3,378)