Hello All Experts,
I am trying to execute below line of code but i am not able to create the record into the crm .
var entity = {};
entity["new_geography@odata.bind"] = "/new_geographies(6E5DF7F4-9B52-E811-8126-5065F38A5B01)"; /////This is causing issue
entity["new_closereasonscomments@odata.bind"] = "/new_engagements(6E5DF7F4-9B52-E811-8126-5065F38A5B01)";
var req = new XMLHttpRequest();
req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v9.1/new_closereasonscommentses", true);
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.onreadystatechange = function() {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 204) {
var uri = this.getResponseHeader("OData-EntityId");
var regExp = /\(([^)]+)\)/;
var matches = regExp.exec(uri);
var newEntityId = matches[1];
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send(JSON.stringify(entity));
can anyone help me in figuring out the issue.