Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

MS CRM Web API 2016, JavaScript, FetchXML

$
0
0

Hi Guys,

I am executing Fetchxml with Web API call as below. The problem is, it's not retruning the columns that we mentioned in fetchxml. While debugging the code i can see the below infomation . Is there mistake in my code. Can you please Suggest on this. It's not returming the mentioned columns (new_main_biz_company_id,new_chinese_name)

var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'><entity name='contact'><attribute name='new_chinese_name' /><attribute name='new_main_biz_company_id' /><filter><condition attribute='contactid' operator='eq' value='" + lookupObjValue[0].id + "' /></filter></entity></fetch>";
var fetch = encodeURI(fetchXml);
var entityname = "contacts";
var Query = entityname + "?fetchXml=" + fetch;
var req = new XMLHttpRequest();
req.open("GET", serverURL + "/api/data/v8.0/" + Query, false);
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;
if (dat.length != 0) {

}

else {
var error = JSON.parse(this.response).error;
alert(error.message);
}
}
};
req.send();


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>