To create a new record of an entity in Dynamics 365, use the code below:
var account = {};
account.Name = "Sample Account";
var jsonAccount = window.JSON.stringify(account);
if (typeof($) === 'undefined') {
$ = parent.$;
jQuery = parent.jQuery;
}
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
datatype: "json",
url: Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/AccountSet",
data: jsonAccount,
beforeSend: function (XMLHttpRequest) {
//Specifying this header ensures that the results will be returned as JSON.
XMLHttpRequest.setRequestHeader("Accept", "application/json");
},
success: function (data, textStatus, XmlHttpRequest) {
account = data.d;
alert("Success");
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
errorHandler(XMLHttpRequest, textStatus, errorThrown);
}
});
This will create the account in Dynamics 365:


Keep learning. Keep building.
Explore AI, agents & Microsoft technology.
I share practical ideas, tutorials, and videos about AI, AI agents, Microsoft technologies, and the Power Platform.
Subscribe on YouTube →Carl de Souza Enterprise Architect at Microsoft · AI Technology Expert