Xrm.WebApi.online.executeMultiple (Client API reference)
Execute a collection of action, function, or CRUD operations.
Note
This method is supported only for the online mode (Xrm.WebApi.online).
If you want to execute multiple requests in a transaction, you must pass in a change set as a parameter to this method. Change sets represent a collection of operations that are executed in a transaction. You can also pass in individual requests and change sets together as parameters to this method.
Note
- You cannot include read operations (retrieve, retrieve multiple, and Web API functions) as part of a change set; this is as per the OData v4 specifications.
- Requests can contain up to 1000 individual requests and cannot contain other batches. More information: Execute batch operations.
Syntax
Execute multiple requests:
var requests = [req1, req2, req3];
Xrm.WebApi.online.executeMultiple(requests).then(successCallback, errorCallback);
Execute multiple requests in a transaction:
In this case, req1, req2, and req3 will be executed in transaction.
var changeSet = [req1, req2, req3];
var requests = [changeSet];
Xrm.WebApi.online.executeMultiple(requests).then(successCallback, errorCallback);
Execute a mix of individual requests and multiple requests in a transaction:
In this case, req1, req2, and req3 will be executed in transaction, but req4 and req5 will be executed individually.
var changeSet = [req1, req2, req3];
var requests = [req4, req5, changeset];
Xrm.WebApi.online.executeMultiple(requests).then(successCallback, errorCallback);
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| requests | Array of objects | Yes | An array of one of the following types:
See request examples earlier in the **Syntax** section for more information. |
| successCallback | Function | No | A function to call when operation is executed successfully. An array of response objects are passed to the function where each response object has the following values:
|
| errorCallback | Function | No | A function to call when the operation fails. |
Return Value
On success, returns a promise containing an array of objects with the values specified earlier in the description of successCallback function.