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

Notifications

Announcements

No record found.

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.

I have the same question (0)
  • Amandeep Singh (Defacto Infotech Mohali) Profile Picture
    26 on at
    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);
        }
    );
  • powerQuest Profile Picture
    2 on at
    I have the same issue. Did you get any solution for this?
  • yannickhuo Profile Picture
    4 on at
    I have exactly the same issue. Is it a recent bug ?
  • Suggested answer
    yannickhuo Profile Picture
    4 on at
    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
                });
            });
        });
    }

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 74 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 31 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans