Wednesday 1 July 2020

Show/Hide button based on security role using Entity Privilege on Microsoft Dynamics CE

I came across this request sometimes ago but I implemented it using code: JavaScript. Nevertheless, my client still experienced issues because the button is not visible at certain times.

So I had to search for another solution: using Entity Privilege. This is simple and it works well.

The steps are below. These steps are grouped into two

  1. On the Ribbon WorkBench Tool (RWB Tool)
  2. On Dynamics 365/CRM: Entity and Security Customization
My scenario is to show Procure button on quote entity when quote status is Won for a user with Procurement Officer or Procurement Admin Role

On Dynamics: Entity and Solution Creation

  • Create an entity. e.g. button access
  • Add the new entity (button access) and other entities you want to work on in the RB Tool to a solution

On RWB Tool

  • Open Ribbon Work Bench tool (RB Tool) and select your solution
  • Right-click the button and choose "customize command"

  • Display Rule: Add an EntityPrivilegeRule, 
    • Set Default to True
    • EntityName to the new entity created (button access)
    • PrivilegeDepth to Basic
    • PrivilegeType to Create or anyone you wish

  • Add Display Rule to Command

  • Publish your ribbon customization.

On Dynamics: Security 

  • Open Security role and select anyone you want to edit
  • Select Custom entities and locate the new entity (button access)
  • Give User/Basic Privilege as shown in the image below
  • Procure Button on Quote entity.


No comments:

Post a Comment