Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

Dynamics 365 why record is not being created .

Posted on by

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.

  • Verified answer
    EmployeeOcta Profile Picture
    EmployeeOcta on at
    RE: Dynamics 365 why record is not being created .

    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)";

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Dynamics 365 why record is not being created .

    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

    community.dynamics.com/.../306776

  • EmployeeOcta Profile Picture
    EmployeeOcta on at
    RE: Dynamics 365 why record is not being created .

    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"

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans