Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

xrm.wepApi.Execute for creating multiple records in one go

(0) ShareShare
ReportReport
Posted on by 20

Hi ,

i was trying to create multiple records by using below code example but i am getting error in payload construction.

1)is it possible to create multiple records with xrm.webApi.Execute in single go like below

2)if not wny sample example for doing so with any other approach

var Sdk = window.Sdk || {};

/**
* Request to execute a create operation
*/
Sdk.CreateRequest = function(entityName, payload) {
this.etn = entityName;
this.payload = payload;
};

// NOTE: The getMetadata property should be attached to the function prototype instead of the
// function object itself.
Sdk.CreateRequest.prototype.getMetadata = function () {
return {
boundParameter: null,
parameterTypes: {},
operationType: 2, // This is a CRUD operation. Use '0' for actions and '1' for functions
operationName: "Create",
};
};
// Construct a request object from the metadata
var payload = [{
name: "Fabrikam Inc."
},{name:"test"}];
var createRequest = new Sdk.CreateRequest("account", payload);

// Use the request object to execute the function
Xrm.WebApi.online.execute(createRequest)
.then(function (response) {
if (response.ok) {
console.log("Status: %s %s", result.status, result.statusText);

// The Create request does not return any response body content. So we
// need not access the response.json() property.

// Perform other operations as required.
}
})
.catch(function(error) {
console.log(error.message);
// handle error conditions
});

  • Suggested answer
    meelamri Profile Picture
    meelamri 13,212 User Group Leader on at
    RE: xrm.wepApi.Execute for creating multiple records in one go

    Hi ShubhamJain7,

    You can use batch operation. Please refer to this blog: www.erickmccollum.com/.../HowToSendWebApiBatchRequestsD365.html

    Docs: www.erickmccollum.com/.../HowToSendWebApiBatchRequestsD365.html

    Also, you can use Xrm.WebApi.online.executeMultiple(). It allows us to execute a collection of action, function, or CRUD operations:

    docs.microsoft.com/.../executemultiple

    debajmecrm.com/.../

    Good Luck !

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans