Understanding Context References in Dynamics 365 Subgrid and Form Customizations using Ribbon Workbench
In Dynamics 365, JavaScript customizations offer a powerful way to enhance the user interface and functionality. A common scenario involves custom ribbon buttons that execute JavaScript functions. These functions often require context about the form or subgrid from which they are invoked. This article clarifies how to access and use these contexts effectively.
1. Consistent Context with primaryControl
:
primaryControl
is a key parameter provided to JavaScript functions in Dynamics 365 ribbon commands. It consistently holds the context of the parent form, regardless of its origin - main grid, main form, or subgrid. This uniformity allows developers to reliably manipulate the form's properties and data.
2. Utilizing Parent Form's Context:
Accessing the parent form's data via primaryControl
follows the standard JavaScript API provided by Dynamics 365:
selectedControl
is used. It provides subgrid-specific information, such as the entity name, which is accessible even when no rows are selected:selectedControl.getParentForm
is a method that, if available, allows retrieval of the parent form's entity and form names:
No comments:
Post a Comment