function getSearchResults(searchString) {
debugger;
var req = new XMLHttpRequest();
var results;
req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v9.1/EntitysPlurualName?$select=Field1,Field2&$filter=contains(productid/disc_codicepanthera,'" + searchString + "') or contains(productid/description,'" + searchString + "') or contains(productid/name,'" + searchString + "') or contains(productid/productnumber,'" + searchString + "')", false);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");
req.onreadystatechange = function () {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 200) {
results = JSON.parse(this.response);
}
else {
}
}
};
req.send();
return results;
}
Comments
Post a Comment