Mutations Schema (Beta)
AVAILABLE API VERSION |
---|
API v59.0 and later |
The Mutation
operation type has a uiapi
field with 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.
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 right 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.
The UIAPIMutations
type has three fields-RecordCreate
, RecordDelete
, and RecordUpdate
-for each object type accessible to the user. Account
is shown as an example.
The UIAPIMutations
type contains fields for creating, deleting, and updating records.
The RecordCreate
field accepts the RecordCreateInput
object type as an argument with a RecordCreateRepresentation
type. AccountCreateInput
is shown as an example.
The RecordCreateRepresentation
type represents the record data provided as input for record creation mutation. AccountCreateRepresentation
type is shown as an example.
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.
The RecordCreatePayload
type returns the result of record creation. It returns a Record
object with its corresponding fields. AccountCreatePayload
is shown as an example.
The Record
object maps to a Salesforce object and its fields, including fields with parent and children relationships. The response payload also contains the Id
of the new record if it's successful.
The RecordDelete
field accepts the RecordDeleteInput
object type as an argument. AccountDeleteInput
is shown as an example.
The RecordDeletePayload
type returns the Id
field of the deleted record. AccountDeletePayload
is shown as an example.
The RecordUpdate
field accepts the RecordUpdateInput
object type as an argument with a RecordUpdateRepresentation
type. AccountUpdateInput
is shown as an example.
The RecordUpdateRepresentation
type represents the record data provided as input for record creation mutation. AccountUpdateRepresentation
type is shown as an example.
The input type for RecordUpdate
contains fields that are updateable. It includes a non-null Id
field for specifying which record should be updated.
The Id
field isn't included in the RecordUpdateRepresentation
type.
The RecordUpdatePayload
type defines the result of record update. AccountUpdatePayload
is shown as an example.
The success
field returns true
or false
to denote if the update is successful.