i wrote these codes to count distinct items from a subgrid based on value of a column :
function GetGridValues()
{
var rowData;
var entity;
var attribute;
var i =0;
var columnValue;
var counts =1;
var filteredRecordCount = Xrm.Page.getControl("invoicedetailsGrid").getGrid().getTotalRecordCount();
for( i=0; i<filteredRecordCount ; i++)
{
rowData [i] = Xrm.Page.getControl("invoicedetailsGrid").getGrid().getRows().get(i).getData();
entity = rowData.getEntity();
attribute = entity.getAttributes();
columnValue [i]= attribute.get('new_main_team').getValue();
}
columnValue.sort();
for (j = 0; j < columnValue.length ; j++) {
if (columnValue[j] != columnValue[j+1]) {
counts += 1;
}
}
Xrm.Page.getAttribute("new_mainteam_count").setValue(counts);
}
but it does not work and display these error :
object does not support property or method "getGrid"
*This post is locked for comments