[Quick Tip] Get SubGrid View Id using Primary Control or Selected Control for Ribbon button’s enable rule in Dynamics 365 CRM.
Use case: I have two entity Awards and Awards category. We have SubGrid on the Awards entity form for Category with Custom Ribbon button. We want to have the button should be visible on specific view only and below are steps to do so.
Step 1: Configure the Ribbon Button
Create a Ribbon Button, create a command and enable rule. Added enable to Command and command to ribbon button. To enable rule, create a custom rule and pass the JavaScript and parameter.
Step 2: Get View id based on the CRM parameter:
Now, Get Subgrid view id by passing the CRM parameter in the custom rule.
When CRM parameter is Primary Control
When CRM parameter is Selected Control