Menu
updateState
Update an existing state — pass its current version and an array of update actions.
Use it in a workflow
- Add a step and choose the Commercetools connector.
- Pick the updateState action (under Update).
- Fill in the fields below, then reference the result from later steps as
{{updatestate.response.data}}.
Query
This is the mutation the action sends by default. Edit it in the step's Query field to change which fields come back.
mutation UpdateState($version: Long!, $actions: [StateUpdateAction!]!, $id: String, $key: String) {
updateState(version: $version, actions: $actions, id: $id, key: $key) {
id
version
key
type
roles
nameAllLocales {
locale
value
}
descriptionAllLocales {
locale
value
}
builtIn
transitionsRef {
typeId
id
}
transitions
initial
createdAt
lastModifiedAt
createdBy {
isPlatformClient
clientId
externalUserId
anonymousId
customerRef {
typeId
id
}
userRef {
typeId
id
}
associateRef {
typeId
id
}
attributedTo {
clientId
source
userRef
}
}
lastModifiedBy {
isPlatformClient
clientId
externalUserId
anonymousId
customerRef {
typeId
id
}
userRef {
typeId
id
}
associateRef {
typeId
id
}
attributedTo {
clientId
source
userRef
}
}
}
}
Variables
Pass these as a JSON object in the step's Variables field.
{
"version": "string",
"actions": [
{
"addRoles": {
"roles": "string"
},
"changeInitial": {
"initial": "string"
},
"changeKey": {
"key": "string"
},
"changeType": {
"type": "string"
},
"removeRoles": {
"roles": "string"
},
"setDescription": {
"description": "string"
},
"setName": {
"name": "string"
},
"setRoles": {
"roles": "string"
},
"setTransitions": {
"transitions": "string"
}
}
],
"id": "string",
"key": "string"
}
Response
Read the result with {{updatestate.response.data.data.updateState}}. If the API returns errors, the step fails and they are at {{updatestate.response.data.errors}}.
Need more? See the Commercetools guide for connection setup and behaviour shared by every action.
Was this page helpful?