When opportunities are Closed as Won they are locked down. There is a button on the ribbon that allows us to reopen them though if need be.
Is there a way to control who has access to this button?
*This post is locked for comments
When opportunities are Closed as Won they are locked down. There is a button on the ribbon that allows us to reopen them though if need be.
Is there a way to control who has access to this button?
*This post is locked for comments
Hi,
I had the similar requirement but in my case I wanted to display an error message to the user if he doesn't have the right access. I managed to achieve this by adding a new field on the user entity "Advanced Opportunity Access" and then create a real time workflow which trigger on change of status.
Within the workflow, I check if the modified by (user) has that field check r not. If not, stop the workflow as cancelled (with error message).
If you wish, you can also have the same implementation and if required instead of having a field on the user entity, you can simply add a direct check within the real time workflow i.e. if modified by (user) = 'Some User' then throw error.
Hope this helps.
You can follow Mr.Alex's suggestion.pls follow below for that approach.
[View:https://www.powerobjects.com/2016/05/17/solving-security-headaches-display-rules-based-on-security-roles/]
If You want show and hide the Button for specific role or user using is then follow below.
function getUerRoles()
{
var roleid = Xrm.Page.context.getUserRoles();
var name;
for (var i = 0; i < roleid.length; i++) {
var roleID = roleid[i];
var RoleName = getRoleName(roleID);
if (RoleName == 'System Administrator') {
return true;
}
else
{
return false;
}
}
}
function getRoleName(roleID) {
var serverUrl = Xrm.Page.context.getClientUrl();
var OdataURL = serverUrl + "/XRMServices/2011/OrganizationData.svc" + "/" + "RoleSet?$filter=RoleId eq guid'" + roleID + "'";
var roleName = null;
$.ajax({
type: "GET",
async: false,
contentType: "application/json; charset=utf-8", datatype: "json",
url: OdataURL,
beforeSend:
function (XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("Accept", "application/json");
},
success:
function (data, textStatus, XmlHttpRequest) {
var result = data.d;
roleName = result.results[0].Name;
},
error:
function (XmlHttpRequest, textStatus, errorThrown) {
// alert('OData Select Failed: ' + odataSelect);
}
});
return roleName;
}
Hope this helps.
You can also create an edit rule, that will call a JavaScript function.
The JavaScript function can check the security role of the logged in user, and based on that security role name, set it to either be visible or not.
Check Ribbon Workbench enable rules (custom rule), Xrm.Page.context.getUserRoles(), and create a function is user in role to check if the user is a member of a particular role that you would designate for this purpose.
Hope this helps.
You might create a new custom entity and a security role that will allow, let's say, "Delete" on that entity.. The you can assign that role to the users who are supposed to have access to the button. Then you can follow the link above to only display that opportunity button for the users who have "Delete" permission on that custom entity
This would allow to appear just for users we want it to?
Hi,
Pretty sure you can use ribbon workbench for this:
ribbonworkbench.uservoice.com/.../76681-hide-a-standard-out-of-the-box-button-based-on-a
André Arnaud de Cal...
292,516
Super User 2025 Season 1
Martin Dráb
231,407
Most Valuable Professional
nmaenpaa
101,156