Skip to main content

Notifications

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();

    }

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 671 Super User 2025 Season 1

#2
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 167 Super User 2025 Season 1

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 138 Most Valuable Professional

Product updates

Dynamics 365 release plans