locked
Hide ribbon button based on security role RRS feed

  • Question

  • Is it possible to hide a ribbon button based on whether the user has a specific privilege role? (as opposed to whether the user has a specific privilege on a specific entity).

     

    I want to hide the "Resolve/Reactivate" button from the case form for all users except those with a the "Case Manager" role. I cannot do it by using an EntityPrivilegeRule because there are no privileges for "setstate" so I cannot define who has the privilege to resolve cases. I have created a plugin that validates who can resolve cases by checking whether the user belongs to the "Case Manager" role. I would like the same behaviour for the ribbon, any ideas?

    Monday, May 16, 2011 11:37 AM
    Moderator

Answers

All replies

  • +1

    The ability to export a report to PDF is linked to the "Export to Excel" privilege.  We want our users to be able to export a report to PDF, but not export to Excel.  So, we would like to hide the Export to Excel button for everyone but system admins and system customizers. 

    Thanks to everyone having useful input!

    Tuesday, May 17, 2011 5:44 PM
  • Hi Gonzalo,

    i would advice the following thigs to do  whoch can be a workable solution for your issue. Instead of hiding you can achieve this with enable disable the button.

    1. i would hide the 'Resolve Case button'<< which is Out  of the Box>>
    2. Create  a new button 'which is a mimic of 'Resolve case button' including the actions and every thing
    3. i would add a custom rule for enabling the button
    4. in this custom rule i will call a js function., which checks  for the user role. if the user belongs to the particular role then only the button will be enabled., other wise the button will be disabled.
    5. i have checked this and working fine.,
    6. you can have the complete solution at http://dynamicscrm2011.wordpress.com/2011/05/19/ribbon-customization-part-11enabledisable-ribbon-button-based-on-security-role/
    7. you can get the entire source code of the solution at http://cid-29ee01e5c986863e.office.live.com/embedicon.aspx/Dynamics%20CRM%202011%20Files/Case^_0^_0^_1.zip

    Please advice me if you have any issues with this.

     

     

    Thanks!


    Siva Polisetty http://dynamicscrm2011.wordpress.com If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"
    Thursday, May 19, 2011 1:37 AM
  • Hi Nevin,

     my advice is to  Disable the ' Export to Excel ' button depending the security role. and enable the button for the 'System Administrators' and ' system Customizers'.

    you can check the link for the similar implementation http://dynamicscrm2011.wordpress.com/2011/05/19/ribbon-customization-part-11enabledisable-ribbon-button-based-on-security-role/

    Thanks!


    Siva Polisetty http://dynamicscrm2011.wordpress.com If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"
    Thursday, May 19, 2011 2:12 AM
  • Hi Siva,

    I used the javascript you wrote to identify the user roles and with just a bit of customization got a working solution, by default disabling the "Export to Excel" button, but having it enabled for system administrators and system customizers only.

    Thanks so very much!

    Tuesday, May 31, 2011 9:09 PM
  • Hi Navin,

    Can u please share your solution for the same query. I am also stuck up with enabling - disabling tabs and buttons according to security role.

    Thank You !


    Wednesday, June 6, 2012 11:26 AM