Wednesday, November 26, 2014

Hiding Advanced Find Button based on the Entity Privilege Rule in MS CRM 2013



Sample Scenario: I want to show the ‘Advanced Find’ button only to the users who have the ‘System Administrator’ privilege. For rest of the users, the ‘Advanced Find’ button needs to be hidden.



Step by Step Procedures as below. 
 1. We are going to hide the ‘Advanced Find’ button based on the ‘Entity Privilege Role’ and hence we need to create a control entity, for which we can set the <EntityPrivilegeRule>

 2. WIn my case, I am creating a new entity named ‘View Advanced Find’.
Note: By default the ‘System Administrator’ Role will contain all the privileges for this newly created entity.

 3. Now, create a new solution, add the ‘Application Ribbon’ into it and export the solution.
  
 



The untouched version of the ‘customization.xml’  looks something like below, 

   

         4. Now, open the solution through ‘Ribbon Workbench Tool’
   


Once the application ribbon is loaded, there are two ‘Advanced Find’ buttons where we need to specify the Entity Privilege Rule. 


                i) Mscrm.BasicHomeTab.Tools.AdvancedFind

                ii) Mscrm.OpenGridAdvancedFind


Starting with ‘Mscrm.BasicHomeTab.Tools.AdvancedFind’, Right click on the button and click on the ‘Customize Command’ option.




Now under the Commands in the Solution Elements, we can find that a new Command is added. Right Click on the newly created command (In my Case Mscrm.OpenAdvancedFind) and click on ‘Edit Display Rules’ 




Click on the ‘+Add New’ button to create a new display rule. 




Specify the Rule Id of your choice and click on ‘Add Step’ button to add the ‘Entity Privilege Rule’






In the ‘Entity Privilege Rule’ specify the name of the control entity that we created before (View Advanced Find)



And specify the ‘PrivilegeDepth’ and ‘PrivilegeDepth’ property.



Now publish the modified solution and only the users who are having the ‘Create’ privilege for the control entity (View Advanced Find entity) will be able to view the ‘Advanced Find’ button in MS CRM.
  
Happy Learning!!!

2 comments: