Answered by:
Enabling/Disabling a button according to entity user privilege

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
Answers
-
Hello Balhito,
Check following article - http://mileyja.blogspot.com/2011/09/retrieve-permission-set-user-or-team.html
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)
- Marked as answer by DavidJennawayMVP, Moderator Wednesday, January 4, 2012 1:10 PM
Tuesday, November 22, 2011 8:49 AMModerator
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.
- i would hide the 'Resolve Case button'<< which is Out of the Box>>
- Create a new button 'which is a mimic of 'Resolve case button' including the actions and every thing
- i would add a custom rule for enabling the button
- 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.
- i have checked this and working fine.,
- you can have the complete solution at http://dynamicscrm2011.wordpress.com/2011/05/19/ribbon-customization-part-11enabledisable-ribbon-button-based-on-security-role/
- 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 -
Hello Balhito,
Check following article - http://mileyja.blogspot.com/2011/09/retrieve-permission-set-user-or-team.html
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)
- Marked as answer by DavidJennawayMVP, Moderator Wednesday, January 4, 2012 1:10 PM
Tuesday, November 22, 2011 8:49 AMModerator