// CRM 2011 JS: Insert FetchXml into subgrid chart's view
function UpdateSubGrid() {
var accountSales = document.getElementById("SalesSummary");
if (accountSales.readyState != "complete") {
setTimeout('UpdateSubGrid()', 1000);
return;
}
var accID = Xrm.Page.data.entity.getId();
alert(accID);
var accountNum = Xrm.Page.getAttribute("jensen_accountnumber").getValue();
var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>";
fetchXml += " <entity name='account'>";
fetchXml += " <attribute name='jensen_yeartodatesales' />";
fetchXml += " <attribute name='jensen_yeartodateplan' />";
fetchXml += " <attribute name='jensen_lastyearsales' />";
fetchXml += " <attribute name='name' />";
fetchXml += " <filter type='and'>";
fetchXml += " <condition attribute='statecode' operator='eq' value='0' />";
fetchXml += " <condition attribute='accountnumber' operator='eq' value='";
fetchXml += accountNum;
fetchXml += "' />";
fetchXml += " </filter>";
fetchXml += " <order attribute='name' descending='false' />";
fetchXml += " </entity></fetch>";
alert(fetchXml);
accountSales.control.setParameter("fetchXml", fetchXml);
accountSales.control.refresh();
}
No comments:
Post a Comment