web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Dynamically set filters on editable grids in Dynamics 365 9.1 Unified Interface

(0) ShareShare
ReportReport
Posted on by 30

Is it possible to dynamically set a filter on an editable grid from within a control event handler in the current version of Dynamics 365 Unified Interface?

I want to dynamically set a filter on an editable grid with JavaScript on Dynamics 365 9.1 Unified Interface. In this case the user selects a row from the first grid, and matching records get listed in the second grid.

There are many articles and forums about setting a filter using JS and FetchXML. They mainly use one of the 3 methods to access a grid for setting a filter.

1. Using: executionContext.getFormContext().getControl("...")

This is the supported way to access an element. However, getFormContext returns gridRowContext when called from a grid event. I was unable to access the form and the other grid this way.

2. Using: Xrm.Page.getControl("...").getGrid()

This is the deprecated method to access an element. But this way we can access another control from a triggered event, working around the issue in the 1st method. However, when accessed this way, the control doesn't give us the SetParameter method which is required to set the filter.

3. Using: window.parent.document.getElementById("...")

This is the worst, unsupported way to access an element. However, this was apparently the last resort before the Unified Interface. In the current version I naturally can't access the grid this way as the system holds controls differently, within IFrames.

I'll try keeping a global reference to the control in the Form.onLoad event, but this may not work or bring other issues.

I have the same question (0)
  • LeoAlt Profile Picture
    16,331 Moderator on at

    Hi partner,

    1.About using "executionContext", you could trigger this method in form onload event to get the formContext. And then use other functions.

    You could refer to this doc for more details about grid control.

    pastedimage1576808845113v1.png

    https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/grids

    2.We do not suggest you to use Xrm.Page to get attribute or control in UCI cause it will not be supported in UCI in the future.

    3.Original JS method is no supported in Dynamics 365 form.

    Best Regards,

    Leo

  • DeadDuck Profile Picture
    30 on at

    Thank you Leo. The problem is I need the formContext when a select event gets triggered, instead of formLoad. Perhaps the form context can be saved globally on form load and used later in the event, but the state will be changed so I'm not sure if it would work without issues.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
11manish Profile Picture

11manish 156

#2
Pallavi Phade Profile Picture

Pallavi Phade 102 Super User 2026 Season 1

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 55 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans