
Announcements
function OnLoad(executionContext) {
"use strict";
var formContext = executionContext.getFormContext(); // Get Form Context
var tabContext = formContext.ui.tabs.get("tab_a");
tabContext.addTabStateChange(filterSubgrid);
filterSubgrid(executionContext);
}
function filterSubgrid(executionContext) {
var formContext = executionContext.getFormContext();
var Id = formContext.data.entity.getId();
var subgrid = formContext.getControl("Subgrid_S");
if (subgrid) {
var fetchXml;
if (Id != null) {
fetchXml = "<fetch version='1.0' mapping='logical' distinct='true'>"
+ "<entity name='...'>"
+ "<attribute name='...'/>"
+ "<filter type='and'>"
+ "<condition attribute='...' operator='eq' value='" + Id + "' uiname='' uitype='...' />"
+ "</filter>"
+ "</entity>"
+ "</fetch>";
}
// Set the fetchXml to the subgrid
subgrid.setFilterXml(fetchXml);
subgrid.refresh();
}
}