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
- On the Ribbon WorkBench Tool (RWB Tool)
- 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