younifyd
Menu

updateApprovalFlow

Advance or update an approval flow — approve, reject, or change approvers on a pending order.

Use it in a workflow

  1. Add a step and choose the Commercetools connector.
  2. Pick the updateApprovalFlow action (under Update).
  3. Fill in the fields below, then reference the result from later steps as {{updateapprovalflow.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 UpdateApprovalFlow($version: Long!, $actions: [ApprovalFlowUpdateAction!]!, $asAssociate: AsAssociateArgument!, $id: String!) {
  updateApprovalFlow(
    version: $version
    actions: $actions
    asAssociate: $asAssociate
    id: $id
  ) {
    status
    approvals {
      approver {
        associateRoleAssignments
        customerRef
        customer
      }
      approvedAt
    }
    rejection {
      rejecter {
        associateRoleAssignments
        customerRef
        customer
      }
      rejectedAt
      reason
    }
    orderRef {
      typeId
      id
    }
    order {
      customerId
      customer {
        id
        customerNumber
        email
        addresses
        defaultShippingAddressId
        defaultBillingAddressId
        shippingAddressIds
        billingAddressIds
        isEmailVerified
        customerGroupRef
        externalId
        key
        authenticationMode
        firstName
        lastName
        middleName
        title
        locale
        salutation
        dateOfBirth
        companyName
        vatId
        password
        customerGroup
        defaultShippingAddress
        defaultBillingAddress
        shippingAddresses
        billingAddresses
        storesRef
        stores
        customerGroupAssignments
        custom
        version
        createdAt
        lastModifiedAt
        createdBy
        lastModifiedBy
      }
      customerEmail
      anonymousId
      customLineItems {
        id
        key
        nameAllLocales
        money
        totalPrice
        slug
        quantity
        state
        taxCategory
        taxCategoryRef
        taxRate
        taxedPrice
        taxedPricePortions
        perMethodTaxRate
        discountedPricePerQuantity
        custom
        shippingDetails
        priceMode
        recurrenceInfo
      }
      totalPrice {
        type
        currencyCode
        centAmount
        fractionDigits
      }
      taxedPrice {
        totalNet
        totalGross
        taxPortions
        totalTax
      }
      discountOnTotalPrice {
        discountedAmount
        includedDiscounts
        discountedNetAmount
        discountedGrossAmount
      }
      shippingAddress {
        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
      }
      billingAddress {
        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
      }
      inventoryMode
      taxMode
      priceRoundingMode
      taxRoundingMode
      taxCalculationMode
      customerGroup {
        id
        version
        name
        key
        createdAt
        lastModifiedAt
        custom
        createdBy
        lastModifiedBy
      }
      customerGroupRef {
        typeId
        id
      }
      country
      shippingKey
      shippingInfo {
        shippingMethodName
        price
        shippingRate
        taxRate
        deliveries
        discountedPrice
        shippingMethodState
        estimatedDelivery
        shippingMethod
        shippingMethodRef
        taxCategory
        taxCategoryRef
        taxedPrice
      }
      discountCodes {
        discountCodeRef
        state
        discountCode
      }
      directDiscounts {
        id
        value
        target
      }
      refusedGifts {
        cartPredicate
        stackingMode
        isActive
        requiresDiscountCode
        key
        discountGroupRef
        nameAllLocales
        descriptionAllLocales
        referenceRefs
        custom
        validFrom
        validUntil
        storesRef
        stores
        discountGroup
        value
        target
        sortOrder
        recurringOrderScope
        id
        version
        createdAt
        lastModifiedAt
        createdBy
        lastModifiedBy
      }
      refusedGiftsRefs {
        typeId
        id
      }
      paymentInfo {
        payments
        paymentRefs
      }
      locale
      shippingRateInput {
        type
      }
      origin
      storeRef {
        typeId
        key
      }
      store {
        id
        version
        key
        nameAllLocales
        languages
        countries
        productSelections
        distributionChannelsRef
        distributionChannels
        supplyChannelsRef
        supplyChannels
        storefront
        createdAt
        lastModifiedAt
        custom
        createdBy
        lastModifiedBy
      }
      itemShippingAddresses {
        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
      }
      businessUnit {
        id
        key
        name
        contactEmail
        addresses
        defaultShippingAddress
        defaultBillingAddress
        defaultShippingAddressId
        defaultBillingAddressId
        shippingAddresses
        billingAddresses
        shippingAddressIds
        billingAddressIds
        status
        storesRef
        stores
        storeMode
        unitType
        associates
        associateMode
        inheritedAssociates
        custom
        parentUnitRef
        parentUnit
        ancestors
        inheritedStores
        topLevelUnitRef
        topLevelUnit
        approvalRuleMode
        customerGroupAssignments
        version
        createdAt
        lastModifiedAt
        createdBy
        lastModifiedBy
      }
      businessUnitRef {
        typeId
        key
      }
      shipping {
        shippingKey
        shippingInfo
        shippingAddress
        shippingRateInput
        shippingCustomFields
      }
      taxedShippingPrice {
        totalNet
        totalGross
        taxPortions
        totalTax
      }
      shippingMode
      shippingCustomFields {
        typeRef
        type
      }
      placement
      discountTypeCombination {
        type
      }
      completedAt
      orderNumber
      orderState
      stateRef {
        typeId
        id
      }
      state {
        id
        version
        key
        type
        roles
        nameAllLocales
        descriptionAllLocales
        builtIn
        transitionsRef
        transitions
        initial
        createdAt
        lastModifiedAt
        createdBy
        lastModifiedBy
      }
      shipmentState
      paymentState
      syncInfo {
        channelRef
        channel
        externalId
        syncedAt
      }
      returnInfo {
        items
        returnTrackingId
        returnDate
      }
      purchaseOrderNumber
      lastMessageSequenceNumber
      cartRef {
        typeId
        id
      }
      cart {
        customerId
        customer
        customerEmail
        anonymousId
        customLineItems
        totalPrice
        taxedPrice
        discountOnTotalPrice
        shippingAddress
        billingAddress
        inventoryMode
        taxMode
        priceRoundingMode
        taxRoundingMode
        taxCalculationMode
        customerGroup
        customerGroupRef
        country
        shippingKey
        shippingInfo
        discountCodes
        directDiscounts
        refusedGifts
        refusedGiftsRefs
        paymentInfo
        locale
        shippingRateInput
        origin
        storeRef
        store
        itemShippingAddresses
        businessUnit
        businessUnitRef
        shipping
        taxedShippingPrice
        shippingMode
        shippingCustomFields
        placement
        discountTypeCombination
        cartState
        key
        purchaseOrderNumber
        lock
        custom
        deleteDaysAfterLastModification
        totalLineItemQuantity
        recurringPaymentConfiguration
        freezeStrategy
        warnings
        id
        version
        createdAt
        lastModifiedAt
        createdBy
        lastModifiedBy
      }
      quoteRef {
        typeId
        id
      }
      quote {
        customerRef
        customer
        customerGroupRef
        customerGroup
        customLineItems
        totalPrice
        taxedPrice
        shippingAddress
        billingAddress
        itemShippingAddresses
        inventoryMode
        taxMode
        priceRoundingMode
        taxRoundingMode
        taxCalculationMode
        country
        shippingInfo
        paymentInfo
        directDiscounts
        shippingRateInput
        storeRef
        store
        businessUnit
        businessUnitRef
        key
        quoteState
        stagedQuoteRef
        stagedQuote
        quoteRequestRef
        quoteRequest
        validTo
        sellerComment
        buyerComment
        custom
        stateRef
        state
        purchaseOrderNumber
        id
        version
        createdAt
        lastModifiedAt
        createdBy
        lastModifiedBy
      }
      recurringOrderRef {
        typeId
        id
      }
      recurringOrder {
        key
        recurringOrderState
        cartRef
        cart
        startsAt
        resumesAt
        expiresAt
        lastOrderAt
        nextOrderAt
        skipConfiguration
        businessUnit
        businessUnitRef
        custom
        stateRef
        state
        originOrderRef
        originOrder
        schedule
        customerRef
        customer
        customerEmail
        storeRef
        store
        id
        version
        createdAt
        lastModifiedAt
        createdBy
        lastModifiedBy
      }
      custom {
        typeRef
        type
      }
      id
      version
      createdAt
      lastModifiedAt
      createdBy {
        isPlatformClient
        clientId
        externalUserId
        anonymousId
        customerRef
        userRef
        associateRef
        attributedTo
      }
      lastModifiedBy {
        isPlatformClient
        clientId
        externalUserId
        anonymousId
        customerRef
        userRef
        associateRef
        attributedTo
      }
    }
    rules {
      key
      name
      description
      status
      predicate
      approvers {
        tiers
      }
      requesters {
        associateRole
        associateRoleRef
      }
      businessUnitRef {
        typeId
        key
      }
      businessUnit {
        id
        key
        name
        contactEmail
        addresses
        defaultShippingAddress
        defaultBillingAddress
        defaultShippingAddressId
        defaultBillingAddressId
        shippingAddresses
        billingAddresses
        shippingAddressIds
        billingAddressIds
        status
        storesRef
        stores
        storeMode
        unitType
        associates
        associateMode
        inheritedAssociates
        custom
        parentUnitRef
        parentUnit
        ancestors
        inheritedStores
        topLevelUnitRef
        topLevelUnit
        approvalRuleMode
        customerGroupAssignments
        version
        createdAt
        lastModifiedAt
        createdBy
        lastModifiedBy
      }
      custom {
        typeRef
        type
      }
      id
      version
      createdAt
      lastModifiedAt
      createdBy {
        isPlatformClient
        clientId
        externalUserId
        anonymousId
        customerRef
        userRef
        associateRef
        attributedTo
      }
      lastModifiedBy {
        isPlatformClient
        clientId
        externalUserId
        anonymousId
        customerRef
        userRef
        associateRef
        attributedTo
      }
    }
    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
      }
    }
    eligibleApprovers {
      associateRole {
        key
        buyerAssignable
        name
        permissions
        custom
        id
        version
        createdAt
        lastModifiedAt
        createdBy
        lastModifiedBy
      }
      associateRoleRef {
        typeId
        key
      }
    }
    pendingApprovers {
      associateRole {
        key
        buyerAssignable
        name
        permissions
        custom
        id
        version
        createdAt
        lastModifiedAt
        createdBy
        lastModifiedBy
      }
      associateRoleRef {
        typeId
        key
      }
    }
    currentTierPendingApprovers {
      associateRole {
        key
        buyerAssignable
        name
        permissions
        custom
        id
        version
        createdAt
        lastModifiedAt
        createdBy
        lastModifiedBy
      }
      associateRoleRef {
        typeId
        key
      }
    }
    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
rejectobject1 fields
setCustomFieldobject2 fields
setCustomTypeobject4 fields
approveobject1 fields
asAssociateobjectrequired

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

businessUnitKeystringrequired
associateIdstringrequired
idstringrequired
json
{
  "version": "string",
  "actions": [
    {
      "reject": {
        "reason": "string"
      },
      "setCustomField": {
        "name": "string",
        "value": "string"
      },
      "setCustomType": {
        "fields": "string",
        "type": "string",
        "typeKey": "string",
        "typeId": "string"
      },
      "approve": {
        "dummy": "string"
      }
    }
  ],
  "asAssociate": {
    "businessUnitKey": "string",
    "associateId": "string"
  },
  "id": "string"
}

Response

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

statusstring
approvalsarray<object>
approverobject
approvedAtobject
rejectionobject
rejecterobject3 fields
rejectedAtstring
reasonstring
orderRefobject
typeIdstring
idstring
orderobject
customerIdstring
customerobject37 fields
customerEmailstring
anonymousIdstring
customLineItemsarray<object>
totalPriceobject4 fields
taxedPriceobject4 fields
discountOnTotalPriceobject4 fields
shippingAddressobject26 fields
billingAddressobject26 fields
inventoryModestring

One ofNoneReserveOnCartReserveOnOrderTrackOnly

taxModestring

One ofDisabledExternalExternalAmountPlatform

priceRoundingModestring

One ofHalfDownHalfEvenHalfUp

taxRoundingModestring

One ofHalfDownHalfEvenHalfUp

taxCalculationModestring

One ofLineItemLevelUnitPriceLevel

customerGroupobject9 fields
customerGroupRefobject2 fields
countrystring
shippingKeystring
shippingInfoobject13 fields
discountCodesarray<object>
directDiscountsarray<object>
refusedGiftsarray<object>
refusedGiftsRefsarray<object>
paymentInfoobject2 fields
localestring
shippingRateInputobject1 fields
originstring

One ofCustomerMerchantQuoteRecurringOrder

storeRefobject2 fields
storeobject17 fields
itemShippingAddressesarray<object>
businessUnitobject35 fields
businessUnitRefobject2 fields
shippingarray<object>
taxedShippingPriceobject4 fields
shippingModestring

One ofMultipleSingle

shippingCustomFieldsobject2 fields
placementstring

One ofInStoreOnline

discountTypeCombinationobject1 fields
completedAtstring
rulesarray<object>
keyobject
nameobject
descriptionobject
statusobject
predicateobject
approversobject
requestersobject
businessUnitRefobject
businessUnitobject
customobject
idobject
versionobject
createdAtobject
lastModifiedAtobject
createdByobject
lastModifiedByobject
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
eligibleApproversarray<object>
associateRoleobject
associateRoleRefobject
pendingApproversarray<object>
associateRoleobject
associateRoleRefobject
currentTierPendingApproversarray<object>
associateRoleobject
associateRoleRefobject
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.