When working with Dynamics 365 and Power Apps, one of the most common requirements is to show related records in a way that is both user-friendly and intuitive. Instead of making users click into multiple forms and tabs, you can leverage the Power Apps grid control to display related records, configure child relationships, and even apply dynamic filtering so users only see the records that matter.
This article walks you through:
1. Enabling the Power Apps grid control
2. Configuring child records to appear on click of parent records (hierarchical expand/collapse)
3. Filtering data in a grid based on records in another subgrid
What is the Power Apps Grid Control?
The Power Apps grid control is a modern data grid that can replace traditional subgrids in Dynamics 365 forms. It offers features like:
1. Hierarchical expand/collapse (to drill into child records)
2. Infinite scrolling
3. Inline editing
4. Modern UI
This makes it perfect for scenarios where users need to see parent-child relationships in one place.
Example Business Scenario
Let’s assume we have the following entities:
1. Group (parent entity)
2. Recovery Strategies (related to Group)
3. Deliverables (related to Group and Recovery Strategy)
4. Tasks (related to Deliverables)
The requirements are:
- On a Group form, show all related Recovery Strategies in one subgrid.
- Show Deliverables in another subgrid, but only those that are connected to the Recovery Strategies listed above.
- Allow Deliverables to expand and display their child Tasks directly in the grid.
Configuring Related Records with Power Apps Grid Control
Step 1: Enable the Grid Control
1. Go to the form editor for your Group entity.
2. Under Components section more components and select PowerApps grid control.
3. Configure PowerApps grid control properties like Child items, Views, Child items Parent Id etc.
4. Publish your form.
This enables the new modern grid experience.
Step 2: Configure Child Records (Expand/Collapse)
The Power Apps grid supports hierarchical data. To enable this:
1. Ensure your child entity (e.g., Tasks) has a relationship with the parent entity (Deliverables).
2. In the subgrid setup for Deliverables, configure the Related Entity (Tasks).
3. Once enabled, you’ll see an expand arrow next to each Deliverable in the grid. Clicking the arrow will show the child Tasks inline, without leaving the page.
This creates a smooth hierarchy:
Group → Deliverables → Tasks
Step 3: Filtering Data Based on Parent Subgrid
Out of the box, the grid will display all Deliverables linked to a Group. But in our case, we wanted to filter Deliverables so that only those tied to the Recovery Strategies listed in the Recovery Strategies subgrid appear.
This requires custom JavaScript that triggers on form’s onLoad event filtering our Deliverables Grid
JavaScript Function:
function filterDeliverablesSubgrid(executionContext) {
const formContext = executionContext.getFormContext();
// Get Current Group Id
const groupId = formContext.data.entity.getId().replace('{', '').replace('}', '');
// Query Recovery Strategies related to the current Group
Xrm.WebApi.retrieveMultipleRecords("student_testrecoverystrategy", `?$select=student_testrecoverystrategyid&$filter=_student_group_value
eq ${groupId}`).then(
function success(result) {
if (result.entities.length > 0) {
let recoveryStrategyIds = result.entities.map(r => r["student_testrecoverystrategyid"]);
// Build FetchXML filter
const fetchXml = `
<filter type="or">
${recoveryStrategyIds.map(id => `<condition attribute="student_recoverystrategy" operator="eq" value="${id}" />`).join("")}
</filter>`;
// Get Deliverables Grid Control
const subgrid = formContext.getControl("cc_1755165041152"); // Deliverables Grid Name
if (subgrid) {
subgrid.setFilterXml(fetchXml);
subgrid.refresh();
}
}
},
function (error) {
console.error("Error fetching Recovery Strategies: ", error.message);
}
);
}
Inline Editing in Power Apps Grid Control
One of the standout features of modern grid control is inline editing. Users can update records directly in the grid without opening a form.
Inline editing can be enabled by configuring the Grid Control Properties
1. Text fields, Option Sets, Dates, and Lookups can be edited inline.
2. Changes are auto-saved when the user clicks out of the field.
3. Reduces clicks and form navigation, making data entry significantly faster.
How it Works:
1. Fetch Recovery Strategies linked to the Group.
2. Collect their IDs.
3. Build a filter XML that only includes Deliverables tied to those Recovery Strategies.
4. Apply the filter to the Deliverables subgrid dynamically.
The Final User Experience
Once implemented:
1. Users open a Group record.
2. The Recovery Strategies subgrid shows all linked strategies.
3. The Deliverables subgrid automatically filters to show only Deliverables tied to those Recovery Strategies.
4. Users can click the arrow next to a Deliverable and instantly view related Tasks inside the same grid.
This gives a seamless parent → child → subchild browsing experience without leaving the Group form.
Final Thoughts and benefits
1. Users save time by not opening multiple forms/tabs
2. Only relevant data appears (filtered Deliverables)
3. Expand/collapse makes navigation intuitive
4. Combines out-of-the-box Power Apps grid capabilities with custom business logic
Conclusion
The Power Apps grid control is a powerful way to modernize record navigation inside Dynamics 365. By combining it with hierarchical relationships and JavaScript-based filtering, you can create highly efficient forms that display exactly the data your users need, when they need it.
This approach is ideal for any scenario where parent-child records are central to your business process, and it makes Dynamics 365 much more user-friendly.