I am executing user saved query using OData in javascript to retrieve usersavedquery GUID but i am facing error "executeUserQuery is not defined"
Kindly suggest what is the issue code.
function executeUserQuery() {
debugger;
var clientUrl = Xrm.Page.context.getClientUrl();
var req = new XMLHttpRequest();
req.open("GET", encodeURI(clientUrl + "/api/data/v8.0/userqueries?$select=name,userqueryid&$filter=name eq 'Fourth Coffee Won Opportunities'", true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.onreadystatechange = function () {
if (this.readyState == 4 /* complete */) {
req.onreadystatechange = null;
if (this.status == 200) {
var data = JSON.parse(this.response);
var dat = data.value;
alert(dat);
}
else {
var error = JSON.parse(this.response).error;
alert(error.message);
}
}
};
req.send();
}
*This post is locked for comments