display records inside powerapps model driven subgrids

13 views Asked by At

I am following this code in order to display the records inside my subgrid. However, its showing 0. Do you have any suggestions about this issue ?

function CallMethod (executionContext) {
var Data = "";
//Initiating Form Context.
var formContext = executionContext.getFormContext();

//Collecting Subgrid Context.
var gridContext = formContext.getControl("Subgrid_new_9");
//Collecting Subgrid Rows.
var myRows = gridContext.getGrid().getRows();
//Obtaining Total Row Count.
var RowCount = myRows.getLength();
//Iterating Through Subgrid Rows.
for (var i = 0; i < RowCount; i++) {
    //Obtaining A Single Row Data.
    var gridRowData = myRows.get(i).getData();
    //Obtaining Row Entity Object.
    var entity = gridRowData.getEntity();
    //Collecing Row EntityRefrence.
    var entityReference = entity.getEntityReference();
    //Adding Up Row Data In A Variable.
    Data += entityReference.name +"\n";
}

console.log(RowCount);
}
0

There are 0 answers