Recently we came across a scenario where we needed to show and hide the subgrid add button on satisfaction of a certain condition. We had to take the help of Ribbon Workbench to achieve the same.
Working:
- Install Ribbon workbench in your Dynamics CRM/365.
- Create a solution with the entity whose subgrid button you want to customize.
- Click on the ‘Ribbon Workbench’ button, and then choose the solution consisting your entity from the options populated.
- Select the entity in the ‘Ribbon Workbench’.
- Then you need to customize the ‘ADD NEW {0}’ button and ‘ADD EXISTING {0}’ button as shown below.
- Then right click on Enable Rules and Add a new rule
- A new rule is created as shown in the screenshot.
- Now, add steps where you will attach the JavaScript function.
- Then go to the ‘Commands’ sections in the main tab and click on the generated command.
- Then add the created enable rule using the lookup button as seen in the below screenshot.
- The ‘Is Core’ Value for custom enable rule should be false, and for the remaining it should be true.
- The result will be as shown below, no ‘+’ sign is seen for the subgrid.
In addition, the button is hidden from the associated view as seen in the below screenshot
Conclusion:
Thus, one can show and hide the add button in the subgrid, depending on certain condition.
Before you move on the next post, Have a look at Click2Clone – Copy Dynamics CRM Records in 1 Click!