var Sdk = window.Sdk || {}; (function () { // Code to run in the form OnLoad event this.formOnLoad = function (executionContext) { var formContext = executionContext.getFormContext(); // Add your code from the other tables here } // Code to run in the column OnChange event this.attributeOnChange = function (executionContext) { var formContext = executionContext.getFormContext(); // Add your code from the other tables here } // Code to run in the form OnSave event this.formOnSave = function (executionContext) { var formContext = executionContext.getFormContext(); // Add your code from the other tables here } // Code to run in the sub-grid onRecordSelect event this.subgridOnRecordSelect = function (executionContext) { var formContext = executionContext.getFormContext(); // Retrieve the record that was selected var selectedRecord = formContext.data.entity; // Open the selected record in a popup var pageInput = { pageType: "entityrecord", entityName: selectedRecord.getEntityName(), entityId: selectedRecord.getId(), // Update with the GUID of the FORM you want to use as the modal form. formId: "16654191-19ad-48ca-9e46-c4b4fbdad76f" }; var navigationOptions = { target: 2, // 1 for inline, 2 for dialog height: { value: 70, unit: "%" }, width: { value: 70, unit: "%" }, position: 2 // 1 for dialog in center, 2 for far side. }; Xrm.Navigation.navigateTo(pageInput, navigationOptions).then( function success() { console.log("Success log"); }, function error() { console.log(error.message); }); } }).call(Sdk);