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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Power FX for Custom created button

(1) ShareShare
ReportReport
Posted on by 17
Hi All
I've created a custom button using PowerApps command bar on Order entity
The button should be visible to user only with particular security roles likes Role1, Role2, Role3
users with any of these roles should only access the button and for rest all the users, the button should be hide/disabled.
How to achieve this using Power-Fx formula or any JS.
I have the same question (0)
  • Suggested answer
    Leah Ju Profile Picture
    Microsoft Employee on at
    Hi,
    You can take advantage of Ribbon Workbench and JavaScript to achieve it. 
    --Get users' security roles to compare them with specific roles and then based on that we return true/false to show/hide the button using ribbon workbench enable rule. 
    Checking security roles of the current user.
    1)getGlobalContext.userSettings (Client API reference)
       Returns information about the current user settings.
       var userSettings = Xrm.Utility.getGlobalContext().userSettings
    2)userSettings.roles
    Please refer to the following blogs for detailed steps:
     

    I hope you can mark my answer verified if it answer your question! If you have any questions, please feel free to contact me.
    Regards,
    Leah
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 184 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 138

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans