Skip to content
Stand with Ukraine flag

Assign to Customer

Use this node to assign the message originator to a customer — for example, automatically assigning a newly provisioned device to the customer specified in its provisioning payload, or reassigning assets based on routing rules. The customer title supports templatization so the target customer can be resolved from the message itself.

  • Customer title — required. Name of the target customer. Supports templatization — use ${metadataKey} and $[dataKey] to resolve dynamically.
  • Create new customer if it doesn’t exist — when enabled, creates a new customer at the tenant level if no match is found. When disabled, a missing customer causes Failure.
  1. Resolve the customer title by substituting patterns from message data and metadata.
  2. Search for an existing customer with the resolved title within the tenant.
  3. If not found and Create new customer is enabled: create the customer and emit an ENTITY_CREATED lifecycle event.
  4. If not found and creation is disabled: route via Failure.
  5. Assign the originator to the target customer. If already assigned to the same customer, no change is made but the operation still succeeds.
  6. Route via Success.
ConnectionCondition
SuccessOriginator assigned (or already assigned to target customer).
FailureCustomer not found and creation disabled, or an unexpected error occurred.
{ "customerNamePattern": "My Customer", "createCustomerIfNotExists": false }

State: My Customer exists. Result: originator assigned to My Customer.


Example 2 — Dynamic customer name from metadata and data

Section titled “Example 2 — Dynamic customer name from metadata and data”

Metadata: { "customerType": "Premium" } | Data: { "region": "North" }

{ "customerNamePattern": "${customerType} - $[region] Region", "createCustomerIfNotExists": false }

Result: pattern resolves to Premium - North Region; originator assigned to that customer.


Example 3 — Create customer if it doesn’t exist

Section titled “Example 3 — Create customer if it doesn’t exist”
{ "customerNamePattern": "New Customer", "createCustomerIfNotExists": true }

State: New Customer does not exist. Result: customer created at tenant level; originator assigned; ENTITY_CREATED event emitted.


Example 4 — Customer not found, creation disabled → Failure

Section titled “Example 4 — Customer not found, creation disabled → Failure”
{ "customerNamePattern": "Non-existent Customer", "createCustomerIfNotExists": false }

Result: customer not found → routes via Failure.

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "TbAssignToCustomerNodeConfiguration",
"type": "object",
"required": ["customerNamePattern"],
"additionalProperties": false,
"properties": {
"customerNamePattern": { "type": "string" },
"createCustomerIfNotExists": { "type": "boolean" }
}
}