Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Issue with FormContext in Subgrid on the Second Page of Subgrid Event

(1) ShareShare
ReportReport
Posted on by

Hello,

I'm currently facing an issue with the FormContext in a subgrid, specifically on the second page of a subgrid on record select event. I'm hoping someone here can provide some guidance or shed some light on this problem.

Here's a brief description of the problem I'm encountering:

  1. I have a subgrid on a form that displays a list of related records.
  2. I've implemented a subgrid on the record select event.
  3. On the first page of the subgrid rows, I am able to access the form context in the record select event. However, when I navigate to the second page of the subgrid without clicking on any row of the first page and try to select a record from the second page records, I am unable to get Form Context in on the record select event.

I've checked the available documentation and community resources but haven't found a specific solution to this problem. I suspect there might be something related to the page lifecycle or the way the subgrid event is handled, but I'm not entirely sure.

If anyone has encountered a similar issue or has any insights on why the FormContext might not be available on the second page of a subgrid event, I would greatly appreciate your help. Any suggestions, workarounds, or pointers in the right direction would be immensely valuable.

Thank you in advance for your assistance!

Best regards,

Vinit Pipaliya.

  • Suggested answer
    yannickhuo Profile Picture
    4 on at
    Issue with FormContext in Subgrid on the Second Page of Subgrid Event
    Next to my response on 7 July, I find a workaround if you want to manipulate grid columns.
     
    For example, this function will disable all columns for a grid "documents". I call this function on OnRecordSelect event.
     
    function DisableAllColumns_DocumentsGrid() {
        var docGrid_control = globalformcontext.getControl("documents"); // globalformcontext is a variable initialized on OnLoad event
        var docGrid_grid = docGrid_control.getGrid();
        var docGrid_selectedrows = docGrid_grid.getSelectedRows();
        docGrid_selectedrows.forEach(function (row, i) {
            var gridrowdata = row.data;
            var gridEntity = gridrowdata.entity;
            var attributes = gridEntity.attributes;
            attributes.forEach(function (gridattribute, j) {
                var name = gridattribute.getName();
                var controls = gridattribute.controls;
                controls.forEach(function (gridcell, k) {
                    gridcell.setDisabled(true); // read only
                });
            });
        });
    }
  • yannickhuo Profile Picture
    4 on at
    Issue with FormContext in Subgrid on the Second Page of Subgrid Event
    I have exactly the same issue. Is it a recent bug ?
  • powerQuest Profile Picture
    2 on at
    Issue with FormContext in Subgrid on the Second Page of Subgrid Event
    I have the same issue. Did you get any solution for this?
  • Amandeep Singh (Defacto Infotech Mohali) Profile Picture
    26 on at
    Issue with FormContext in Subgrid on the Second Page of Subgrid Event
    Hi 
    Use Xrm Web Api retrieveMultipleRecords
     
     
    Xrm.WebApi.retrieveMultipleRecords("Subgrid Entity name", "?$filter=_primarycontactid_value eq "+ YourDynamicIdOfRecord).then(
        function success(results) {
            console.log(results);
            for (var i = 0; i < results.entities.length; i++) {
                var result = results.entities[i];
                // Columns
                var accountid = result["accountid"]; // Guid
            }
        },
        function(error) {
            console.log(error.message);
        }
    );

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,099 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans
Liquid error: parsing "/globalsearch/?q=jdmxmxmxn+x+cmlcldnc+xkxm++xbygsjsksjd+xmxnxn+c+++XLOSLmsnkdmdklxncb++++kxnxisosospwlsmncnnchyyudiedkkddxnxknxnxnxldlsmnxbxjdldkspslskwkwlmebrhyydududiidoppeAMAJSHYYUUSIEIWOPA+ILALOAOWPAAMSMSNDMHYTUDJDKSL+xodmxn" - Nested quantifier +.