Mutations Schema

AVAILABLE API VERSION
Beta v59.0–65.0
Generally available v66.0 and later

The Mutation operation type has a uiapi field with a UIAPIMutationsInput argument. The UIAPIMutationsInput argument has a boolean argument allOrNone that has a default value of true. When true, all operations are rolled back and not executed if one or more operations fail.

Mutation Operation Type
1type Mutation {
2  uiapi(input: UIAPIMutationsInput): UIAPIMutations!
3}
4
5input UIAPIMutationsInput {
6  allOrNone: Boolean
7}

Use mutations to create, update, or delete records. Under the UIAPIMutations type, each Salesforce object corresponds to a RecordCreate, RecordEdit, and RecordDelete field that accepts a response payload you define. Only objects supported by UI API are available for mutations.

Access to supported objects and fields on those objects is controlled by the context user’s object-level and field-level permissions. That is, an object is accessible if the user has the correct permissions, and the object is either on the supported object list or is a custom object.

To view the GraphQL API schema via introspection, use the Altair GraphQL Client.

Note

UIAPIMutations Type 

The UIAPIMutations type has three fields—RecordCreate, RecordDelete, and RecordUpdate—for each object type accessible to the user. Here is the Account example.

UIAPIMutations Specification
1type UIAPIMutations {
2  AccountCreate ( input AccountCreateInput!
3  ): AccountCreatePayload
4  AccountDelete ( input RecordDeleteInput!
5  ): RecordDeletePayload
6  AccountUpdate ( input AccountUpdateInput!
7  ): AccountUpdatePayload
8}

The UIAPIMutations type contains fields for creating, deleting, and updating records.

RecordCreate Field 

The RecordCreate field accepts the RecordCreateInput object type as an argument with a RecordCreateRepresentation type. Here is the AccountCreateInput example.

AccountCreateInput Input
1input AccountCreateInput {
2  Account: AccountCreateRepresentation!
3}

The RecordCreateRepresentation type represents the record view after the create mutation operation completes. The RecordCreateRepresentation differs from the RecordRepresentation that is used for querying records. The RecordCreateRepresentation excludes foreign key details (other than ID) and child relationships because the related objects aren’t part of the mutation operation.

Here is the AccountCreateRepresentation example.

AccountCreateRepresentation Type
1type AccountCreateRepresentation {
2  AccountNumber: String
3  AccountSource: Picklist
4  AnnualRevenue: Currency
5  # Other Account fields
6}

The input type for RecordCreate contains fields that are createable. Required fields must be non-null. If you don’t include the OwnerId field, it’s set to the context user.

The Id field isn’t included in the RecordCreateRepresentation type.

Note

RecordCreatePayload Type 

The RecordCreatePayload type returns the result of record creation. It returns a Record object with its corresponding fields. Here is the AccountCreatePayload example.

AccountCreatePayload Type
1type AccountCreatePayload {
2  Record: Account
3}

The Record object maps to a Salesforce object and its fields. The response payload also contains the Id of the new record if it’s successful.

RecordDelete Field 

The RecordDelete field accepts the RecordDeleteInput object type as an argument. Here is the AccountDeleteInput example.

AccountDeleteInput Input
1input AccountDeleteInput {
2  Id: IdOrRef!
3}

RecordDeletePayload Type 

The RecordDeletePayload type returns the Id field of the deleted record. Here is the AccountDeletePayload example.

AccountDeletePayload Type
1type AccountDeletePayload {
2  Id: ID
3}

RecordUpdate Field 

The RecordUpdate field accepts the RecordUpdateInput object type as an argument with a RecordUpdateRepresentation type. Here is the AccountUpdateInput example.

AccountUpdateInput Input
1input AccountUpdateInput {
2  Account: AccountUpdateRepresentation!
3  Id: IdOrRef!
4}

The RecordUpdateRepresentation type represents the record view after the update mutation operation completes. The RecordUpdateRepresentation differs from the RecordRepresentation that is used for querying records. The RecordUpdateRepresentation excludes foreign key details (other than ID) and child relationships because the related objects aren’t part of the mutation operation.

Here is the AccountUpdateRepresentation example.

AccountUpdateRepresentation Type
1type AccountUpdateRepresentation {
2  AccountNumber: String
3  AccountSource: Picklist
4  AnnualRevenue: Currency
5  # Other Account fields
6}

The input type for RecordUpdate contains fields that are updateable. It includes a non-null Id field for specifying which record to update.

The Id field isn’t included in the RecordUpdateRepresentation type.

Note

RecordUpdatePayload Type 

The RecordUpdatePayload type returns the result of record update. It returns a Record object with its corresponding fields. Here is the AccountUpdatePayload example.

AccountUpdatePayload Type
1type AccountUpdatePayload {
2  Record: Account
3}

The Record object maps to a Salesforce object and its fields.

The RecordUpdatePayload type includes the Record field in API v66.0 and later. In API v59–65, the RecordUpdatePayload type includes a success field returning true or false to denote if the update is successful.

Note