How to hide/show the button based on security role using ribbon workbench in dcrm?

 function hide(primaryControl)

{

debugger;

        var formContext = primaryControl;

        var userSettings = Xrm.Utility.getGlobalContext().userSettings.securityRoles;


        var roleId = "7b00263756-A437-EC11-8C64-000D3AF0478E"; 

       

        roleId = roleId.toLowerCase();       

        for (var i = 0; i < userSettings.length; i++) {


            var userRoleId = userSettings[i];


            if (userRoleId == roleId) {


                // Return true if the Role matches

                formContext.ui.tabs.get("DETAILS_TAB").setVisible(true);

                alert("successfully tab show");

                return true;


            }


        }

        formContext.ui.tabs.get("DETAILS_TAB").setVisible(false);

         alert("successfully tab hide");

        return false;


}

Comments

Popular posts from this blog

latest dynamics 365 interview questions

difference between enable rule vs display rule in ribbon workbench

If i create one record that created record date is older than 3 days, then I want to perform some operation with the help of business rule.