I have two buttons on ribbon of my form.i want these buttons to appear only to particular set of users,can anyone please help me to achieve this .
*This post is locked for comments
I have two buttons on ribbon of my form.i want these buttons to appear only to particular set of users,can anyone please help me to achieve this .
*This post is locked for comments
Radu,
Your solution with a custom entity is to heavy for just showing and hiding a button. I would recommend a display/enable rule for this.
Hi Sandesh,
You can enable / disable the buttons based on a privilege : social.microsoft.com/.../hide-ribbon-button-based-on-users-privilege-on-a-specific-record
For example you create a custom entity and grant read access over it only to certain users (via a custom security role) and then have that button visible only for the users who have read privilege over that entity)
Regards,
Radu
Hi,
Yes you can achieve using enable rule. First retrieve the role of an user and based on his role you can return true or false.
function CheckUserRole() {
var currentUserRoles = Xrm.Page.context.getUserRoles();
var userRoleName = new String();
for (var i = 0; i < currentUserRoles.length; i++) {
var userRoleId = currentUserRoles[i];
userRoleName += GetRoleName(userRoleId) + ",";
}
return userRoleName;
}
function includes(container, value) {
var returnValue = false;
var pos = container.indexOf(value);
if (pos >= 0) {
returnValue = true;
}
return returnValue;
}
function Enablerule(){
var roleNameofCurrentUser = CheckUserRole().replace(",", "");
if ((includes(roleNameofCurrentUser, "your role name[To whom you wanna show]"))
return true;
else return false;
}
Note: Here I mentioned include function also because default JS include will not work in IE few version.
After completion of your JS now go to your button and add enable rule. And enter your function name and Library name.
After that it will work fine.
Hi,
You need to achieve this using enable and disable rules based on security roles.Following links may be helpful to you:
community.dynamics.com/.../how-to-disable-a-crm-2016-ribbon-button-based-on-form-name
garethtuckercrm.com/.../dynamically-disable-ribbon-buttons-in-dynamics-crm
Thanks:)
Hi Sandesh,
you can control it through security roles of the user , please use ribbon workbench.
ribbonworkbench.uservoice.com/.../76681-hide-a-standard-out-of-the-box-button-based-on-a
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,214 Most Valuable Professional
nmaenpaa 101,156