//Call from CategoryLvl1Id onchange event
CategoryLvl1Lookup = function () {
Xrm.Page.getAttribute("categorylevel2id").setValue(null); //clear field
if (Xrm.Page.getAttribute("categorylevel1id").getValue() != null) {
var id = Xrm.Page.getAttribute("i5_categorylevel1id").getValue()[0].id;
CategoryLvl1Lookup = function () {
Xrm.Page.getAttribute("categorylevel2id").setValue(null); //clear field
if (Xrm.Page.getAttribute("categorylevel1id").getValue() != null) {
var id = Xrm.Page.getAttribute("i5_categorylevel1id").getValue()[0].id;
var lookupAttributeEntityName = "categorylevel2";
var lookupAttributeName = "categorylevel2id";
var viewDisplayName = "Filtered Records";
var viewId = Xrm.Page.getControl(lookupAttributeName).getDefaultView();
GetViewDetails(viewId);
var lookupAttributeName = "categorylevel2id";
var viewDisplayName = "Filtered Records";
var viewId = Xrm.Page.getControl(lookupAttributeName).getDefaultView();
GetViewDetails(viewId);
var viewDisplayName = "Filtered Records";
var fetchXml = '<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"> <entity name="categorylevel2"><all-attributes/><filter type="and"> <condition attribute="categorylevel1id" operator="eq" value="' + id + '" /> </filter> </entity></fetch>';
Xrm.Page.getControl("categorylevel2id").addCustomView(viewId, "categorylevel2", viewDisplayName, fetchXml, layoutXml, true);
var fetchXml = '<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"> <entity name="categorylevel2"><all-attributes/><filter type="and"> <condition attribute="categorylevel1id" operator="eq" value="' + id + '" /> </filter> </entity></fetch>';
Xrm.Page.getControl("categorylevel2id").addCustomView(viewId, "categorylevel2", viewDisplayName, fetchXml, layoutXml, true);
}
SetTitle();
SetTitle();
No comments:
Post a Comment