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

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Hide Out of box button "Promote to Admin" on user entity except for system administrators

(0) ShareShare
ReportReport
Posted on by
Hello All,
I am trying to hide "promote to admin" button for all the users except system administrators.
i write a javascript function as below:

i have added this javascript in the enable rules in XRM tool box and published it, but still that button was visible to other users in the crm.

can anyone assist me here on where i need to correct to hide this OOB button?
 
function IsSystemAdministrator(){
 
            var userRoles = Xrm.Utility.getGlobalContext().userSettings.securityRoles;
            var adminRole ="System Administrator";
            for (var i=0; i<userRoles.getlength();i++);{
            var role =userRoles.get(i);
            if(role.name===adminRole){
                return true
                }
            }
            return value;
        }
Categories:
1.png
2.png

Your file is currently under scan for potential threats. Please wait while we review it for any viruses or malicious content.

I have the same question (0)

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

Responsible AI policies

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

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 235

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 177

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 156 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans