Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to Control Access to Reopen Opportunity?

(0) ShareShare
ReportReport
Posted on by

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

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: How to Control Access to Reopen Opportunity?

    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.

  • Verified answer
    Syed Ibrahim Profile Picture
    Syed Ibrahim 6,257 on at
    RE: How to Control Access to Reopen Opportunity?

    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.

  • Verified answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: How to Control Access to Reopen Opportunity?

    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.

  • Verified answer
    ashlega Profile Picture
    ashlega 34,477 on at
    RE: How to Control Access to Reopen Opportunity?

    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

  • RE: How to Control Access to Reopen Opportunity?

    This would allow to appear just for users we want it to?

  • Suggested answer
    ashlega Profile Picture
    ashlega 34,477 on at
    RE: How to Control Access to Reopen Opportunity?

    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

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans