younifyd
Menu

createMyBusinessUnit

Create a new business unit for the signed-in customer.

Use it in a workflow

  1. Add a step and choose the Commercetools connector.
  2. Pick the createMyBusinessUnit action (under Create).
  3. Fill in the fields below, then reference the result from later steps as {{createmybusinessunit.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 CreateMyBusinessUnit($draft: MyBusinessUnitDraft!) {
  createMyBusinessUnit(draft: $draft) {
    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 {
        typeRef
        type
      }
    }
    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 {
        typeRef
        type
      }
    }
    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 {
        typeRef
        type
      }
    }
    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 {
        typeRef
        type
      }
    }
    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 {
        typeRef
        type
      }
    }
    shippingAddressIds
    billingAddressIds
    status
    storesRef {
      typeId
      key
    }
    stores {
      id
      version
      key
      nameAllLocales {
        locale
        value
      }
      languages
      countries {
        code
      }
      productSelections {
        productSelectionRef
        productSelection
        active
      }
      distributionChannelsRef {
        typeId
        id
      }
      distributionChannels {
        id
        version
        key
        roles
        nameAllLocales
        descriptionAllLocales
        address
        geoLocation
        createdAt
        lastModifiedAt
        reviewRatingStatistics
        custom
        createdBy
        lastModifiedBy
      }
      supplyChannelsRef {
        typeId
        id
      }
      supplyChannels {
        id
        version
        key
        roles
        nameAllLocales
        descriptionAllLocales
        address
        geoLocation
        createdAt
        lastModifiedAt
        reviewRatingStatistics
        custom
        createdBy
        lastModifiedBy
      }
      storefront {
        checkoutUrlTemplate
        orderUrlTemplate
        termsOfServiceUrl
        privacyPolicyUrl
        refundPolicyUrl
        shippingPolicyUrl
        cookiePolicyUrl
        imprintUrl
        faqUrl
        contactUrl
      }
      createdAt
      lastModifiedAt
      custom {
        typeRef
        type
      }
      createdBy {
        isPlatformClient
        clientId
        externalUserId
        anonymousId
        customerRef
        userRef
        associateRef
        attributedTo
      }
      lastModifiedBy {
        isPlatformClient
        clientId
        externalUserId
        anonymousId
        customerRef
        userRef
        associateRef
        attributedTo
      }
    }
    storeMode
    unitType
    associates {
      associateRoleAssignments {
        associateRoleRef
        associateRole
        inheritance
      }
      customerRef {
        typeId
        id
      }
      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
      }
    }
    associateMode
    inheritedAssociates {
      associateRoleAssignments {
        associateRoleRef
        associateRole
        sourceRef
        source
      }
      customerRef {
        typeId
        id
      }
      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
      }
    }
    custom {
      typeRef {
        typeId
        id
      }
      type {
        key
        nameAllLocales
        descriptionAllLocales
        resourceTypeIds
        id
        version
        createdAt
        lastModifiedAt
        createdBy
        lastModifiedBy
      }
    }
    parentUnitRef {
      typeId
      key
    }
    parentUnit
    ancestors
    inheritedStores {
      store {
        id
        version
        key
        nameAllLocales
        languages
        countries
        productSelections
        distributionChannelsRef
        distributionChannels
        supplyChannelsRef
        supplyChannels
        storefront
        createdAt
        lastModifiedAt
        custom
        createdBy
        lastModifiedBy
      }
      storeRef {
        typeId
        key
      }
    }
    topLevelUnitRef {
      typeId
      key
    }
    topLevelUnit
    approvalRuleMode
    customerGroupAssignments {
      customerGroupRef {
        typeId
        id
      }
      customerGroup {
        id
        version
        name
        key
        createdAt
        lastModifiedAt
        custom
        createdBy
        lastModifiedBy
      }
    }
    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.

draftobjectrequired
keystringrequired
namestringrequired
contactEmailstring
addressesarray<object>26 fields
defaultBillingAddressnumber
defaultShippingAddressnumber
shippingAddressesarray<number>
billingAddressesarray<number>
customobject4 fields
unitTypestringrequired

One ofCompanyDivision

storeModestring
parentUnitobject3 fields
json
{
  "draft": {
    "key": "string",
    "name": "string",
    "unitType": "Company",
    "contactEmail": "string",
    "addresses": [
      {
        "country": "string",
        "id": "string",
        "title": "string",
        "salutation": "string",
        "firstName": "string",
        "lastName": "string",
        "streetName": "string",
        "streetNumber": "string",
        "additionalStreetInfo": "string",
        "postalCode": "string",
        "city": "string",
        "region": "string"
      }
    ],
    "defaultBillingAddress": 0,
    "defaultShippingAddress": 0,
    "shippingAddresses": [
      0
    ],
    "billingAddresses": [
      0
    ],
    "custom": {
      "typeId": "string",
      "typeKey": "string",
      "type": {
        "typeId": "string",
        "id": "string",
        "key": "string"
      },
      "fields": [
        "string"
      ]
    },
    "storeMode": "string",
    "parentUnit": {
      "typeId": "string",
      "id": "string",
      "key": "string"
    }
  }
}

Response

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

idstring
keystring
namestring
contactEmailstring
addressesarray<object>
idobject
streetNameobject
streetNumberobject
additionalStreetInfoobject
postalCodeobject
cityobject
regionobject
stateobject
countryobject
companyobject
departmentobject
buildingobject
apartmentobject
pOBoxobject
additionalAddressInfoobject
externalIdobject
keyobject
phoneobject
mobileobject
emailobject
faxobject
titleobject
salutationobject
firstNameobject
lastNameobject
customobject
defaultShippingAddressobject
idstring
streetNamestring
streetNumberstring
additionalStreetInfostring
postalCodestring
citystring
regionstring
statestring
countrystring
companystring
departmentstring
buildingstring
apartmentstring
pOBoxstring
additionalAddressInfostring
externalIdstring
keystring
phonestring
mobilestring
emailstring
faxstring
titlestring
salutationstring
firstNamestring
lastNamestring
customobject2 fields
defaultBillingAddressobject
idstring
streetNamestring
streetNumberstring
additionalStreetInfostring
postalCodestring
citystring
regionstring
statestring
countrystring
companystring
departmentstring
buildingstring
apartmentstring
pOBoxstring
additionalAddressInfostring
externalIdstring
keystring
phonestring
mobilestring
emailstring
faxstring
titlestring
salutationstring
firstNamestring
lastNamestring
customobject2 fields
defaultShippingAddressIdstring
defaultBillingAddressIdstring
shippingAddressesarray<object>
idobject
streetNameobject
streetNumberobject
additionalStreetInfoobject
postalCodeobject
cityobject
regionobject
stateobject
countryobject
companyobject
departmentobject
buildingobject
apartmentobject
pOBoxobject
additionalAddressInfoobject
externalIdobject
keyobject
phoneobject
mobileobject
emailobject
faxobject
titleobject
salutationobject
firstNameobject
lastNameobject
customobject
billingAddressesarray<object>
idobject
streetNameobject
streetNumberobject
additionalStreetInfoobject
postalCodeobject
cityobject
regionobject
stateobject
countryobject
companyobject
departmentobject
buildingobject
apartmentobject
pOBoxobject
additionalAddressInfoobject
externalIdobject
keyobject
phoneobject
mobileobject
emailobject
faxobject
titleobject
salutationobject
firstNameobject
lastNameobject
customobject
shippingAddressIdsarray<string>
billingAddressIdsarray<string>
statusstring

One ofActiveInactive

storesRefarray<object>
typeIdobject
keyobject
storesarray<object>
idobject
versionobject
keyobject
nameAllLocalesobject
languagesobject
countriesobject
productSelectionsobject
distributionChannelsRefobject
distributionChannelsobject
supplyChannelsRefobject
supplyChannelsobject
storefrontobject
createdAtobject
lastModifiedAtobject
customobject
createdByobject
lastModifiedByobject
storeModestring
unitTypestring

One ofCompanyDivision

associatesarray<object>
associateRoleAssignmentsobject
customerRefobject
customerobject
associateModestring

One ofExplicitExplicitAndFromParent

inheritedAssociatesarray<object>
associateRoleAssignmentsobject
customerRefobject
customerobject
customobject
typeRefobject2 fields
typeobject10 fields
parentUnitRefobject
typeIdstring
keystring
parentUnitobject

Recursive reference to BusinessUnit, not further expanded.

ancestorsarray<object>
inheritedStoresarray<object>
storeobject
storeRefobject
topLevelUnitRefobject
typeIdstring
keystring
topLevelUnitobject

Recursive reference to BusinessUnit, not further expanded.

approvalRuleModestring

One ofExplicitExplicitAndFromParent

customerGroupAssignmentsarray<object>
customerGroupRefobject
customerGroupobject
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.

createMyBusinessUnit — Commercetools — Documentation