Webresources associated to an Entity are stored inside “FormXml” of that entity as follows.
To get the FormXml of an entity we need to query “SystemForm” with some filter condiion . The following code snippet helps us to find WebResources associated to an Entity.
var WebResourceArray = Array(); var filter, sytemforms, formxml; filter = "Type/Value eq 2 and ObjectTypeCode eq '" + Enter Entity LogicalName + "'"; sytemforms = GetRecords('SystemForm', null, filter, null, null, null); formxml = StringtoXML(sytemforms.results[0].FormXml); for (i = 0; i < formxml.getElementsByTagName("formLibraries")[0].childNodes.length; i++) { // Hold all Webresource in an Array WebResourceArray.push( formxml.getElementsByTagName("formLibraries")0].childNodes[i].getAttribute("name") ); } // RetriveMultiple method function GetRecords(odataSetName, columnset,filter, successCallback, errorCallback) { var serverUrl = “http://localhost:5555”;//Enter your server url var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc"; //Build the URI var odataUri = serverUrl + ODATA_ENDPOINT + "/" + odataSetName; //If a filter is supplied, append it to the OData URI if (filter) { odataUri += filter; } //Asynchronous AJAX function to Retrieve CRM records using OData $.ajax({ type: "GET", contentType: "application/json; charset=utf-8", datatype: "json", url: odataUri, beforeSend: function (XMLHttpRequest) { //Specifying this header ensures that the results will be returned as JSON. XMLHttpRequest.setRequestHeader("Accept", "application/json"); }, success: function (data, textStatus, XmlHttpRequest) { if (successCallback) { if (data && data.d && data.d.results) { successCallback(data.d.results, textStatus, XmlHttpRequest); } else if (data && data.d) { successCallback(data.d, textStatus, XmlHttpRequest); } else { successCallback(data, textStatus, XmlHttpRequest); } } }, error: function (XmlHttpRequest, textStatus, errorThrown) { if (errorCallback) errorCallback(XmlHttpRequest, textStatus, errorThrown); else errorHandler(XmlHttpRequest, textStatus, errorThrown); } }); }