Skip to main content

Notifications

Announcements

No record found.

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.
  • Suggested answer
    Leah Ju Profile Picture
    Leah Ju Microsoft Employee on at
    Power FX for Custom created button
    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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,735 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans