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

    }

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February 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... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,436 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans