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,...
Unanswered

getrows() not getting row collection on UCI in D365

(0) ShareShare
ReportReport
Posted on by 95

as per my requirement, on a button click i have to get subgrid rows records. for this functionality i am using below code. but it's not working well. 

 var allGridEntities = [];

var rows = formContext.getControl("Warranty_Claim_Line_Items").getGrid().getRows();
rows.forEach(function (row, i) {
allGridEntities.push(row.getData().getEntity().attributes);
});

 i am getting 0 length of sub grid rows while subgrid has one record. i have put two tab on form,  1. General, 2. Warranty Claim Line, after click  on  tab "Warranty Claim Line" subgrid be shows then this function works fine.

Please suggest best solution 

thanks.

4621.Untitled3.jpg

I have the same question (0)
  • cloflyMao Profile Picture
    25,210 on at

    Hi Altaf,

    Is your subgrid set in "Warranty Claim Line" tab?

    If so, the reason of the issue is that subgrids within tabs are not loaded until the tab is expanded, it's by design in UCI.

    There are some solutions as following:

    1. Focus to the "Warranty Claim Line" tab by javascript when you want to get total count of "Warranty_Claim_Line_Items",

    then wait seconds for the subgrid being fully loaded.

    Xrm.Page.ui.tabs.get("Warranty_Claim_Line_TAB").setFocus();
    setTimeout(function(){ 
        var total = formContext.getControl("Warranty_Claim_Line_Items").getGrid().getTotalRecordCount(); 
    }, 8000);

    2. If method 1 is not friendly to user, you might need to retrieve total count of related records by Xrm.WebApi.retrieveMultipleRecords function directly. 

    Please take introduction below as reference:(subgrid is not mentioned in the article, but it's similar to web resources.)

    https://docs.microsoft.com/en-us/powerapps/maker/model-driven-apps/optimize-form-performance#form-scripts

    pastedimage1589956980508v1.png

    Regards,

    Clofly

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 83 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

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

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans