Enabling/Disabling a button according to entity user privilege RRS feed

  • Question

  • Hi All,

    I have a custom button into the salesorder entity,This button generate a record of type(new_BL) from the sales order data.

    I need to Enable or Disable the button according to the privilege of the connected user for the new_BL entity.

    So haw can I retrieve the privilege for a specific entity for a specific user.

    Thanks for help

    Friday, October 28, 2011 11:37 AM


All replies

  • Hi Balhinio,

    i would advice the following thigs to do whoch can be a workable solution for your issue. i have detialed  enableing and diabling the button based on the security role in my post. this can help you.

    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.

    Siva Polisetty http://dynamicscrm2011.wordpress.com If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"
    • Proposed as answer by Makarand Keer Wednesday, November 2, 2011 6:44 AM
    Wednesday, November 2, 2011 3:49 AM
  • Thanks Siva,

    but your solution will check by role name not really access rule in a specific entity like write, read create...

    so if the role has the write privilege on the entity the button will be displayed, otherwise the button will be diseabled.

    privilége list in the role I think is not accessible by SOAP Message!!


    Wednesday, November 16, 2011 10:36 AM
  • Hi Balhinio,

    There is no direct method  like context,getUserRoles() to retrive the privilages.

    but sdk provides a message  RetrieveUserPrivilegesRequest  and  RetrieveUserPrivilegesResponse to get the privilages of the user in the business unit but not on a specific entity.

    with that said i won't recommned to  do  call this from the client side using the process of ( calling server side methods from client side)  as a particular user would have many privilages in the CRM system, say ( couple of hundreds, depending on the enitites on what he/she has the access,so getting those hundred privilages and checking is a huge process and ribbon woul take for a while to open )   

    Siva Polisetty http://dynamicscrm2011.wordpress.com If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"
    Monday, November 21, 2011 10:27 PM
  • Tuesday, November 22, 2011 8:49 AM