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

issue in fetching all subgrid rows values(looping through) via jscript

(0) ShareShare
ReportReport
Posted on by 10

Hi,

i facing issue in fetching all subgrid rows values(looping through) via jscript. eg i m having 3 rows on subgrid(decison) on case form and i need to check three fields(panel decision(option set) , date of sumission(date), durationofdeferralinmonths( numeric) values as condition in any one of row records. in javascript i m unable to fetch all 3 rows also i m unable to fecth option set field, date field , etc value from records.

i m trying following methods not getting expected result. someone please suggest me on it.

var formContext = executionContext.getFormContext();
    //Collecting Subgrid Context.
var DecisiongridContext = formContext.getControl("Subgrid_Decisions");
//Collecting Subgrid Rows.
var myRows = DecisiongridContext.getGrid().getRows();
//Obtaining Total Row Count.
var RowCount = myRows.getLength();
alert('Decision Grid RowCount: '+RowCount);
//loop through each row to get values of each column
myRows.forEach(function (row, i)
{
    var gridColumns = row.getData().getEntity().getAttributes();
    //loop through each column in row
    gridColumns.forEach(function (column, j)
     {
        var atrName = column.getName();
        var atrValue = column.getValue();
    });
});
try2:
var formContext=executionContext.getFormContext();

    var Decisionmonth=[],i;
    var DecisiongridContext = formContext.getControl("Subgrid_Decisions");
//Collecting Subgrid Rows.
var myRows = DecisiongridContext.getGrid().getRows();
//Obtaining Total Row Count.
var RowCount = myRows.getLength();
alert('Decision Grid RowCount: '+RowCount);
if(RowCount==0)
{
setTimeout (DecisionSubGridExecution(),2000)
return;
}
for(i=0;i<RowCount; i++)
{
    var rowEntity=myRows.get(i).getData().getEntity();
alert(rowEntity.attributes.get("durationofdeferralinmonths").getValue());
    Decisionmonth[i]=rowEntity.attributes.get("durationofdeferralinmonths").getValue();

    }
I have the same question (0)

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