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

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
    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.

  • 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

  • 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
    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/

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 66

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 40 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans