younifyd
Menu

updateApprovalRule

Update a B2B approval rule using an array of update actions.

Use it in a workflow

  1. Add a step and choose the Commercetools connector.
  2. Pick the updateApprovalRule action (under Update).
  3. Fill in the fields below, then reference the result from later steps as {{updateapprovalrule.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.

graphql
mutation UpdateApprovalRule($version: Long!, $actions: [ApprovalRuleUpdateAction!]!, $asAssociate: AsAssociateArgument!, $id: String, $key: String) {
  updateApprovalRule(
    version: $version
    actions: $actions
    asAssociate: $asAssociate
    id: $id
    key: $key
  ) {
    key
    name
    description
    status
    predicate
    approvers {
      tiers {
        and
      }
    }
    requesters {
      associateRole {
        key
        buyerAssignable
        name
        permissions
        custom
        id
        version
        createdAt
        lastModifiedAt
        createdBy
        lastModifiedBy
      }
      associateRoleRef {
        typeId
        key
      }
    }
    businessUnitRef {
      typeId
      key
    }
    businessUnit {
      id
      key
      name
      contactEmail
      addresses {
        id
        streetName
        streetNumber
        additionalStreetInfo
        postalCode
        city
        region
        state
        country
        company
        department
        building
        apartment
        pOBox
        additionalAddressInfo
        externalId
        key
        phone
        mobile
        email
        fax
        title
        salutation
        firstName
        lastName
        custom
      }
      defaultShippingAddress {
        id
        streetName
        streetNumber
        additionalStreetInfo
        postalCode
        city
        region
        state
        country
        company
        department
        building
        apartment
        pOBox
        additionalAddressInfo
        externalId
        key
        phone
        mobile
        email
        fax
        title
        salutation
        firstName
        lastName
        custom
      }
      defaultBillingAddress {
        id
        streetName
        streetNumber
        additionalStreetInfo
        postalCode
        city
        region
        state
        country
        company
        department
        building
        apartment
        pOBox
        additionalAddressInfo
        externalId
        key
        phone
        mobile
        email
        fax
        title
        salutation
        firstName
        lastName
        custom
      }
      defaultShippingAddressId
      defaultBillingAddressId
      shippingAddresses {
        id
        streetName
        streetNumber
        additionalStreetInfo
        postalCode
        city
        region
        state
        country
        company
        department
        building
        apartment
        pOBox
        additionalAddressInfo
        externalId
        key
        phone
        mobile
        email
        fax
        title
        salutation
        firstName
        lastName
        custom
      }
      billingAddresses {
        id
        streetName
        streetNumber
        additionalStreetInfo
        postalCode
        city
        region
        state
        country
        company
        department
        building
        apartment
        pOBox
        additionalAddressInfo
        externalId
        key
        phone
        mobile
        email
        fax
        title
        salutation
        firstName
        lastName
        custom
      }
      shippingAddressIds
      billingAddressIds
      status
      storesRef {
        typeId
        key
      }
      stores {
        id
        version
        key
        nameAllLocales
        languages
        countries
        productSelections
        distributionChannelsRef
        distributionChannels
        supplyChannelsRef
        supplyChannels
        storefront
        createdAt
        lastModifiedAt
        custom
        createdBy
        lastModifiedBy
      }
      storeMode
      unitType
      associates {
        associateRoleAssignments
        customerRef
        customer
      }
      associateMode
      inheritedAssociates {
        associateRoleAssignments
        customerRef
        customer
      }
      custom {
        typeRef
        type
      }
      parentUnitRef {
        typeId
        key
      }
      parentUnit
      ancestors
      inheritedStores {
        store
        storeRef
      }
      topLevelUnitRef {
        typeId
        key
      }
      topLevelUnit
      approvalRuleMode
      customerGroupAssignments {
        customerGroupRef
        customerGroup
      }
      version
      createdAt
      lastModifiedAt
      createdBy {
        isPlatformClient
        clientId
        externalUserId
        anonymousId
        customerRef
        userRef
        associateRef
        attributedTo
      }
      lastModifiedBy {
        isPlatformClient
        clientId
        externalUserId
        anonymousId
        customerRef
        userRef
        associateRef
        attributedTo
      }
    }
    custom {
      typeRef {
        typeId
        id
      }
      type {
        key
        nameAllLocales
        descriptionAllLocales
        resourceTypeIds
        id
        version
        createdAt
        lastModifiedAt
        createdBy
        lastModifiedBy
      }
    }
    id
    version
    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.

versionstringrequired
actionsarray<object>required
setCustomFieldobject2 fields
setCustomTypeobject4 fields
setKeyobject1 fields
setNameobject1 fields
setDescriptionobject1 fields
setPredicateobject1 fields
setRequestersobject1 fields
setStatusobject1 fields
setApproversobject1 fields
asAssociateobjectrequired

Create/modify entity as an associate in business-unit.

businessUnitKeystringrequired
associateIdstringrequired
idstring

Queries with specified ID

keystring

Queries with specified key

json
{
  "version": "string",
  "actions": [
    {
      "setCustomField": {
        "name": "string",
        "value": "string"
      },
      "setCustomType": {
        "fields": "string",
        "type": "string",
        "typeKey": "string",
        "typeId": "string"
      },
      "setKey": {
        "key": "string"
      },
      "setName": {
        "name": "string"
      },
      "setDescription": {
        "description": "string"
      },
      "setPredicate": {
        "predicate": "string"
      },
      "setRequesters": {
        "requesters": "string"
      },
      "setStatus": {
        "status": "string"
      },
      "setApprovers": {
        "approvers": "string"
      }
    }
  ],
  "asAssociate": {
    "businessUnitKey": "string",
    "associateId": "string"
  },
  "id": "string",
  "key": "string"
}

Response

Read the result with {{updateapprovalrule.response.data.data.updateApprovalRule}}. If the API returns errors, the step fails and they are at {{updateapprovalrule.response.data.errors}}.

keystring
namestring
descriptionstring
statusstring

One ofActiveInactive

predicatestring
approversobject
tiersarray<object>
requestersarray<object>
associateRoleobject
associateRoleRefobject
businessUnitRefobject
typeIdstring
keystring
businessUnitobject
idstring
keystring
namestring
contactEmailstring
addressesarray<object>
defaultShippingAddressobject26 fields
defaultBillingAddressobject26 fields
defaultShippingAddressIdstring
defaultBillingAddressIdstring
shippingAddressesarray<object>
billingAddressesarray<object>
shippingAddressIdsarray<object>
billingAddressIdsarray<object>
statusstring

One ofActiveInactive

storesRefarray<object>
storesarray<object>
storeModestring
unitTypestring

One ofCompanyDivision

associatesarray<object>
associateModestring

One ofExplicitExplicitAndFromParent

inheritedAssociatesarray<object>
customobject2 fields
parentUnitRefobject2 fields
parentUnitobject

Recursive reference to BusinessUnit, not further expanded.

ancestorsarray<object>
inheritedStoresarray<object>
topLevelUnitRefobject2 fields
topLevelUnitobject

Recursive reference to BusinessUnit, not further expanded.

approvalRuleModestring

One ofExplicitExplicitAndFromParent

customerGroupAssignmentsarray<object>
versionstring
createdAtstring
lastModifiedAtstring
createdByobject8 fields
lastModifiedByobject8 fields
customobject
typeRefobject2 fields
typeobject10 fields
idstring
versionstring
createdAtstring
lastModifiedAtstring
createdByobject
isPlatformClientboolean
clientIdstring
externalUserIdstring
anonymousIdstring
customerRefobject2 fields
userRefobject2 fields
associateRefobject2 fields
attributedToobject3 fields
lastModifiedByobject
isPlatformClientboolean
clientIdstring
externalUserIdstring
anonymousIdstring
customerRefobject2 fields
userRefobject2 fields
associateRefobject2 fields
attributedToobject3 fields

Need more? See the Commercetools guide for connection setup and behaviour shared by every action.