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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

Modern Driven App - Show/Hide button visibiblity using security role FX formulae

(3) ShareShare
ReportReport
Posted on by 6
Hi Team,
 
I would like to apply FX formaule to show/hide button visibility based on specific security role using FX formalue for modern driven app.
 
Please advise.
Categories:
I have the same question (0)
  • Zain Mehmood Profile Picture
    4,187 Most Valuable Professional on at
    This question belongs to Microsoft Power Platform Community Forum Thread, better to post here. 

    Thanks,
    Zain 
  • Suggested answer
    Jimmy Passeti Profile Picture
    674 Most Valuable Professional on at
    Hello,
    Unfornunally, i´ts not possible yet with PowerFX.
    It is only possible using JavaScript.
     
    Below is the code you can use to make it work:
     
    function showHideBasedOnSecurityRole() {
        var usersRoles = Xrm.Utility.getGlobalContext().userSettings.roles;
        var hasRole = false;
        usersRoles.forEach(function hasRoleName(item) {
            if (item.name === 'Role name 1' || item.name === 'Role name 2') {
                    hasRole = true;
            };
        });
        return hasRole;
    };
     
    Regards,
    Jimmy Passeti | Microsoft MVP
    ✅ Please mark as Verified if this answered your question!

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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
iampranjal Profile Picture

iampranjal 75

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 41 Super User 2025 Season 2

#3
Pallavi Phade Profile Picture

Pallavi Phade 24

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans