Hiding button based on security roles from Home page in ribbon workbench using javasscript

Click here to view original web page at community.dynamics.com

Hi Arun,

Thank you for your response !

Using Security role I'm able to achieve my requirement and i did it already.

But I wanted to do it from ribbon workbench which is not working , i called my enable rule for both plateform (form level and Homepage level) and it is working for form level only not for homepage level.

Here is my JS for this.

function HideAssignButton() { 
    var fetchCurrentRole = "<?xml version='1.0'?><fetch distinct='true' mapping='logical' output-format='xml-platform' version='1.0'><entity name='role'><attribute name='name'/><attribute name='roleid'/><order descending='false' attribute='name'/><link-entity name='systemuserroles' intersect='true' visible='false' to='roleid' from='roleid'><link-entity name='systemuser' to='systemuserid' from='systemuserid' alias='as'><filter type='and'><condition attribute='systemuserid' operator='eq-userid'/></filter></link-entity></link-entity></entity></fetch>";
    var SecurityRoles = XrmServiceToolkit.Soap.Fetch(fetchCurrentRole);  
    var rolearray=[];   
    if (SecurityRoles.length > 0) {        
        for (var i = 0; i < SecurityRoles.length; i++) {               
           rolearray[i] = SecurityRoles[i].attributes.name.value;
        if ((rolearray.indexOf("System Administrator") != -1) || (rolearray.indexOf("IT System Admin Manager") != -1) || (rolearray.indexOf("HR System Admin") != -1)) {
            return true;
        else {
            return false;
Leave a Reply

Your email address will not be published. Required fields are marked *