Hi experts,
I created a javascript web resource to store the count of the number of cases created in the past 90 days and display on custom field new_casecount in the account record.
Here is my code. However, I'm getting error:
Here is my code:
function CountCasesPast90Days() { var GUIDvalue = Xrm.Page.data.entity.getId(); alert(GUIDvalue); var fetchXml = "<fetch mapping='logical' distinct='false' aggregate='true'>" + "<entity name='incident'>" + "<attribute name='title' alias='recordcount' aggregate='count' />" + "<filter type='and'>" + "<condition attribute='createdon' operator='last-x-days' value='90' />" + "</filter>" + "<link-entity name='account' from='accountid' to='customerid' link-type='inner' alias='ab'>" + "<filter type='and'>" + "<condition attribute='accountid' operator='eq' value='"+GUIDvalue+"' />" + "</filter>" + "</link-entity>" + "</entity>" + "</fetch>"; alert(fetchXml); Xrm.Page.getAttribute(new_casecount).setValue(fetchXml); }
Both my alert messages are showing data but at the last line, im getting error.
Thanks,
Jon
*This post is locked for comments