I1643.Capture.JPG"/resized-image.ashx/__size/550x0/__key/CommunityServer-Discussions-Components-Files/117/8284.Capture.JPG" border="0" />
Here is my code:
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();
}
Here is the Account form with the subgrid that has the chart in it, highlighted:

This chart us showing ALL accounts rather than being filter to the account I'm in. The new fetchXml that I'm trying to assign it did not get set.