
I create a record using xrmservices.v8.createrecord How can I get the guid of the new record after it's created
Hi,
If you are using web api then you can set below header in request and in return you will get record ID in response.
req.setRequestHeader("Prefer", "odata.include-annotations=\"*\",return=representation");
And use below code to parse the Record GUID from response
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 201) {
var uri = this.getResponseHeader("OData-EntityId");
var regExp = /\(([^)]+)\)/;
var matches = regExp.exec(uri);
var newEntityId = matches[1];
//Handle returned attributes
}