Hello!
I'm trying to execute a stored query by executing its "fetchXml". It looks like this;
<fetch version="1.0" mapping="logical">
<entity name="pss_gridassets">
<attribute name="pss_gridassetsid" />
<attribute name="pss_name" />
<attribute name="createdon" />
<order attribute="pss_name" descending="false" />
<filter type="and">
<condition attribute="statecode" operator="eq" value="0" />
</filter>
</entity>
</fetch>
var fetchXml = '<fetch version="1.0" mapping="logical"><entity name="pss_gridassets"><attribute name="pss_gridassetsid" /><attribute name="pss_name" /><attribute name="createdon" /><order attribute="pss_name" descending="false" /><filter type="and"><condition attribute="statecode" operator="eq" value="0" /></filter></entity></fetch>';
var encodedFetchXml = encodeURI(fetchXml);
var req = new XMLHttpRequest();
req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.0/pss_gridassets?fetchXml=" + encodedFetchXml, true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function () {
if (this.readyState === 4) {
this.onreadystatechange = null;
if (this.status === 200) {
}
}
};
req.send();But as I mentioned I get "404" on that one. Guess there has to be something wrong with the URL, but unless "encodeURI" does work (it does :D) I don't really know whats the problem her. Maybe I cant dump in xml like that for my version?







