Send Mutation Requests (Beta)

AVAILABLE API VERSION
API v59.0 and later

A mutation request modifies your record data by either creating, updating, or deleting the data. When you send a record create request, you can also request for fields from the newly created record in one request. However, you can't query fields with record update and delete requests.

Your request can fail if you have multiple fields with the same name, which results in naming conflicts. To avoid conflicts, use aliases to rename the result of a field.

The uiapi field of UIAPIMutations type has an input field for an allOrNone boolean argument. The default is true.

When allOrNone is true, all operations are rolled back if any operation fails, or all operations are executed within a transaction. When allOrNone is set to false, only operations that fail are rolled back along with any operations that depend on those failed operations, allowing other successful operations to execute.

If you set allOrNone to false when creating multiple accounts, a failed operation doesn't prevent the other operations from successfully executing. In this example, the second operation successfully executes while the first one fails.

The response looks like this.

If allOrNone is true when you are creating multiple accounts, all account creation fails if any single operation fails. In this example, the first account create operation fails because Name if a required field on accounts, so the other operation also fails.

The response looks like this.

The order of operations depend on each operations' dependencies. To enable an operation to use a field from another operation in the same execution, use the @{alias} syntax. See Mutation Field References.

Let's say you are creating multiple accounts and updating them in a single request. The update operation requires the Id field value from the create operation. In this example, the account create operation with the second alias is successful, followed by a successful update on the same account. The first account create fails because a required field is missing.

The response looks like this.