|
Post by Kautuk on Oct 30, 2014 7:31:25 GMT
Script definition : The below script gets the GUID of the selected record in the subgrid.
Code: function getGuidOfSelectedRecordInSubgrid()
{ var mySubGrid = document.getElementById(“SubGridNameHere”); //Enter the Subgrid Name here(instead of 'SubGridNameHere') var selectedId = undefined;
mySubGrid.control.add_onSelectionChange(function (sender) { if (sender.get_selectedIds()[0] == undefined || sender.get_selectedIds()[0] == selectedId) { return; } } }
Steps:
1. Trigger the above script on the onLoad event of the Form. 2. (Do not forget to replace the Subgrid name in the above code. You can get the subgrid name by opening the Form Editor and double clicking on the subgrid. It opens a subgrid properties window and then you can see the Subgrid name.) 3. Test the script by adding an alert statement (at the end of the script) to print the GUID of the selected record. Statement to be added: alert(selectedId); 4. If the alert box displays a GUID when you select a record in the subgrid, then your script is working fine.
Eg of GUID: 8e2c4098-6682-bedc-b325-a3dd6e5703db (It is a 32 character long value which defines the uniqueness of a record also known as Primary Key)
|
|
|
Post by Kautuk on Oct 30, 2014 8:25:31 GMT
NB: This code uses unsupported customizations which can break if the CRM version is updated.
|
|