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
Post a Comment