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.
Configuration
Section titled “Configuration”- 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.
Message processing algorithm
Section titled “Message processing algorithm”- Resolve the customer title by substituting patterns from message data and metadata.
- Search for an existing customer with the resolved title within the tenant.
- If not found and Create new customer is enabled: create the customer and emit an
ENTITY_CREATEDlifecycle event. - If not found and creation is disabled: route via
Failure. - Assign the originator to the target customer. If already assigned to the same customer, no change is made but the operation still succeeds.
- Route via
Success.
Output connections
Section titled “Output connections”| Connection | Condition |
|---|---|
Success | Originator assigned (or already assigned to target customer). |
Failure | Customer not found and creation disabled, or an unexpected error occurred. |
Examples
Section titled “Examples”Example 1 — Assign to existing customer
Section titled “Example 1 — Assign to existing customer”{ "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.
JSON schema
Section titled “JSON schema”{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "TbAssignToCustomerNodeConfiguration", "type": "object", "required": ["customerNamePattern"], "additionalProperties": false, "properties": { "customerNamePattern": { "type": "string" }, "createCustomerIfNotExists": { "type": "boolean" } }}