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 :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

Fetch Privileges from a security role obtained from javascript resultant array

(0) ShareShare
ReportReport
Posted on by 74

Hello,

I was trying to hide a button based on security role.

I created javascript which checks and then hides button for "D365 FS Mobile Resource" security role.

hideButtonForFSMRole = function () {
    debugger;
    var showButtonFlag = true;
    var roles = Xrm.Utility.getGlobalContext().userSettings.roles;
    var role_name = new Array();
    roles.forEach(function (item) {
        role_name.push(item.name);
    });

    if(role_name.length>0){
        for(i=0;i

How do I hide button only when Create privileges of "D365 FS Mobile Resource" is set to none.

I have the same question (0)
  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    It can be achieved without writting any code.

    Please see below blog -

    goutamdascrm.wordpress.com/.../

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

  • Mansi M Profile Picture
    74 on at

    Hello Bipin,

    This does provide the solution to some extent. But in my case single user has more than one security roles. How to overcome in this scenario.

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Mansi M,

    You could use RetrieveRolePrivilegesRole() function to get the privileges in a role.

    Reference:

    community.dynamics.com/.../how-to-retrieve-the-effective-privileges-of-a-user-which-includes-user-role-level-and-team-level-privileges

  • Suggested answer
    Charles Abi Khirs Profile Picture
    3,569 on at

    Hello,

    As Bipin stated, it can be done from the Ribbon workbench provided in the link. And this will cover even if the user has multiple security roles, if one of the security roles has the Create privilege, than it will consider as the user has this privilege and do whatever you set in your display rule.

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
Pallavi Phade Profile Picture

Pallavi Phade 102 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 71

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 55 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans