0

I need to get specific cell value from selected subgrid rows, i've foud a code to attach click event to the subgrid, but it retreive the name or ID fo the row, how to get the cells value?, the code i sue is below :

function ReadSelectedSubGridRecords() {
    if (document.getElementById('Contacts')) {
        var grid = document.getElementById('Contacts').control;
        var ids = grid.get_selectedRecords();
        for (var rowNo = 0; rowNo < grid.get_selectedRecords().length; rowNo++)
            alert(grid.get_selectedRecords()[rowNo].Name);
    }
}

function Form_OnLoad() {
    if (document.getElementById('Contacts')) {
        var grid = document.getElementById('Contacts');
        if (grid.attachEvent) {
            grid.attachEvent('onclick', ReadSelectedSubGridRecords);
        }

    }
    else {
        setTimeout("Form_OnLoad();", 2000);
    }
}
Jawad
  • 111
  • 2
  • 10

1 Answers1

0

You need to call CRM to retrieve record fields using ID you have retrieved. You may use OData REST endpoint. See sample in Dynamics CRM SDK \SDK\SampleCode\JS\RESTEndpoint\JavaScriptRESTDataOperations folder.

Add all provided libraries to your form and update your code to retrieve needed records.

andriikulyk
  • 505
  • 7
  • 13