Hi,
In CRM 2011, we can show the related records in parent record form using sub grids.
For example below is ‘Contacts’ sub grid on ‘Account’ form
Contacts sub-grid
We can get the records count and read the cell values of sub grid using below script.
function getSubGridDetails() {
// Set subgrid schema name
var subGridName = ‘accountcontactsgrid’;
if (document.getElementById(subGridName)) {
var gridControl = document.getElementById(subGridName).control;
// Get records length
var countGridRecords = 0;
if (gridControl && gridControl.getRecordsFromInnerGrid()) {
countGridRecords = gridControl.getRecordsFromInnerGrid().length;
alert(“Subgrid records count – ” + countGridRecords);
}
// Read Cell Values By Row
for (var indxRow = 0; indxRow < countGridRecords; indxRow++)
for (var indxCell = 0; indxCell < gridControl.getRecordsFromInnerGrid()[indxRow][3].cells.length; indxCell++) {
alert(“Cell Value – ” + gridControl.getRecordsFromInnerGrid()[indxRow][3].cells[indxCell].outerText);
}
}
}
🙂



![[Step by Step] Configure and consume 'Environment Variables' of type 'Secret' using 'Azure Key vault'](https://rajeevpentyala.com/wp-content/uploads/2023/05/image.png)
Leave a comment