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.
This issue is because of the schema name, so it got resolved after adding the correct schema name.
entity["new_geography@odata.bind"] = "/new_geographies(6E5DF7F4-9B52-E811-8126-5065F38A5B01)";
entity["new_Geography@odata.bind"] = "/new_geographies(6E5DF7F4-9B52-E811-8126-5065F38A5B01)";
I think this is similar issue , please have a look below thread -
entity["relationshipname@odata.bind"] = "/new_geographies(6E5DF7F4-9B52-E811-8126-5065F38A5B01)" // Try with relationshipname instead of property name
Hello Experts,
while trying to create the record using the console in browser i am facing below error for the above code.
"parameter is not passed or parameter is nNull or undefined"