Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
073bd91
New doc for 'message type switch' rule node
dskarzh Sep 8, 2025
fc28b41
New doc for 'calculated fields' rule node
dskarzh Sep 8, 2025
7a63e2c
Correct description of 'calculated fields' search result
dskarzh Sep 8, 2025
1261771
New doc for 'change owner' rule node
dskarzh Sep 8, 2025
a0c7f8d
New doc for 'remove from group' rule node
dskarzh Sep 8, 2025
d7a8500
New doc for 'create alarm' rule node
dskarzh Sep 9, 2025
e837b35
New doc for 'clear alarm' rule node
dskarzh Sep 9, 2025
a567e8d
Update summary for 'create alarm' and 'clear alarm' rule nodes on ind…
dskarzh Sep 9, 2025
91b177f
New doc for 'copy to view' node
dskarzh Sep 11, 2025
b59444d
New doc for 'assign to customer' node
dskarzh Sep 11, 2025
7880b64
Update description of 'assign to customer' and 'unassign from custome…
dskarzh Sep 11, 2025
c1f9f5e
New doc for 'unassign from customer' rule node
dskarzh Sep 11, 2025
e599c9d
New doc for 'create relation' rule node
dskarzh Sep 11, 2025
630100d
New doc for 'delay (deprecated)' rule node
dskarzh Sep 12, 2025
d87185d
Add summary paragraph for filter nodes; improve one-line summary of f…
dskarzh Sep 15, 2025
ee81c9a
Add summary paragraph for enrichment nodes
dskarzh Sep 15, 2025
6285804
Improve summaries for enrichment nodes
dskarzh Sep 15, 2025
74bfdb5
Improve search result previews for enrichment nodes
dskarzh Sep 15, 2025
1f3ebae
Add summary paragraph for transformation nodes
dskarzh Sep 15, 2025
88b4b63
Improve summaries for transformation rule nodes
dskarzh Sep 15, 2025
d015a49
Add summaries for actions nodes
dskarzh Sep 15, 2025
3cdb641
Make search result descriptions for filter nodes consistent with summ…
dskarzh Sep 15, 2025
e0b62ea
New doc for 'delete attributes' rule node
dskarzh Sep 16, 2025
b5189ba
New doc for 'delete relation' rule node
dskarzh Sep 16, 2025
1440aa0
Small correction for 'delete key-value pairs` search result description
dskarzh Sep 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ The configuration allows you to specify how entities are added to groups and how

1. The node identifies the **owner** of the message originator entity (tenant or customer).
2. It resolves any templates in the **Group name pattern** using values from the message data and metadata.
3. The node searches for an existing entity group matching the resolved group name and entity type.
3. The node searches for an existing entity group matching the resolved group name, entity type and owner of the originator.
4. If **Remove from current groups** is enabled:
- The node retrieves all entity groups that currently contain the originator entity
- It removes the entity from all groups except the target group and the special "All" group
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,238 @@
<table style="width:250px;">
<thead>
<tr>
<td style="text-align: center"><strong><em>Since TB Version 2.2</em></strong></td>
</tr>
</thead>
</table>
Assigns the message originator to a specified customer.

![image](/images/user-guide/rule-engine-2-0/nodes/action-assign-to-customer-node.png)
## Configuration

Assign Message Originator Entity to [Customer](/docs/{{docsPrefix}}user-guide/ui/customers/).
- **Customer title** - The name of the target customer. Supports templatization using `${metadataKey}` or `$[dataKey]` to substitute values from the message metadata or data.
- **Create new customer if it doesn't exist** - When enabled, creates a new customer if no customer matching the title is found. When disabled, the processing fails if the target
customer doesn't exist.

Following Message Originator types are allowed: **Asset**, **Device**, **Entity View**, **Dashboard**.
### JSON Schema

Finds target Customer by customer name pattern and then assign Originator Entity to this customer.
```json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "TbAssignToCustomerNodeConfiguration",
"type": "object",
"properties": {
"customerNamePattern": {
"type": "string",
"description": "Target customer name, supports templatization"
},
"createCustomerIfNotExists": {
"type": "boolean",
"description": "Whether to create a new customer if the target doesn't exist"
}
},
"required": [
"customerNamePattern"
],
"additionalProperties": false
}
```

Will create new Customer if it doesn't exists and **Create new Customer if not exists** is set to **true**.
## Message processing algorithm

Configuration:
1. Resolves any templates in the **Customer title** using values from the message data and metadata.
2. Searches for an existing customer with the resolved title within the tenant.
3. If the customer doesn't exist and **Create new customer if it doesn't exist** is enabled:
- Creates a new customer with the resolved title
- Generates a `ENTITY_CREATED` lifecycle event for the newly created customer
4. If the customer doesn't exist and creation is disabled, the processing fails.
5. Assigns the originator to the target customer.
6. If the entity is already assigned to the target customer, no change is made but the processing is still considered successful.
7. On successful completion, the message is forwarded to the `Success` connection. If an error occurs, the message is routed to the `Failure` connection.

![image](/images/user-guide/rule-engine-2-0/nodes/action-assign-to-customer-node-configuration.png)
## Output connections

- **Customer name pattern** - can be set direct customer name or pattern can be used, that will be resolved to the real customer name using Message metadata.
- **Create new customer if not exists** - if checked will create new customer if it doesn't exist.
- **Customers cache expiration time** - specifies maximum time interval is seconds allowed to store found customers records. 0 value means that records will never expire.
- `Success`
- The entity was successfully assigned to the customer or the entity was already assigned to the target customer.
- `Failure`
- An error occurred during processing, such as the target customer not existing when creation is disabled.

Message will be routed via **Failure** chain in the following cases:
## Examples

- When Originator entity type is not supported.
- Target customer doesn't exist and **Create customer if not exists** is unchecked.
### Example 1 — Assigning to existing customer

In other cases Message will be routed via **Success** chain.
**Incoming message**

Originator: `DEVICE`.

**Node configuration**

```json
{
"customerNamePattern": "My Customer",
"createCustomerIfNotExists": false
}
```

**State of the system**

- A customer named "My Customer" exists under the tenant.
- Originator device is not assigned to any customer.

**Outgoing message**

The outgoing message is identical to the incoming one. Routed via the `Success` connection.

**Result**

The device is assigned to "My Customer".

### Example 2 — Using pattern for customer name

**Incoming message**

Data:

```json
{
"region": "North"
}
```

Metadata:

```json
{
"customerType": "Premium"
}
```

Originator: `ASSET`.

**Node configuration**

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

**State of the system**

- A customer named "Premium - North Region" exists under the tenant.
- Originator asset is not assigned to any customer.

**Outgoing message**

The outgoing message is identical to the incoming one. Routed via the `Success` connection.

**Result**

The pattern `${customerType} - $[region] Region` is resolved by substituting values from metadata and data, resulting in "Premium - North Region". The asset is assigned to this
customer.

### Example 3 — Creating customer if it doesn't exist

**Incoming message**

Originator: `DEVICE`.

**Node configuration**

```json
{
"customerNamePattern": "New Customer",
"createCustomerIfNotExists": true
}
```

**State of the system**

- No customer named "New Customer" exists.
- Originator device is not assigned to any customer.

**Outgoing message**

The outgoing message is identical to the incoming one. Routed via the `Success` connection.

**Result**

Since the customer "New Customer" doesn't exist and `createCustomerIfNotExists` is true, a new customer is created at the tenant level with the title "New Customer". The device is
then assigned to this newly created customer. A `ENTITY_CREATED` lifecycle event for the newly created customer is generated.

### Example 4 — Entity already assigned to target customer

**Incoming message**

Originator: `ASSET`.

**Node configuration**

```json
{
"customerNamePattern": "Target Customer",
"createCustomerIfNotExists": false
}
```

**State of the system**

- "Target Customer" exists under the tenant.
- Originator asset is already assigned to "Target Customer".

**Outgoing message**

The outgoing message is identical to the incoming one. Routed via the `Success` connection.

**Result**

Since the asset is already assigned to "Target Customer", no assignment change is performed, but the processing is considered successful.

### Example 5 — Customer doesn't exist and creation disabled

**Incoming message**

Originator: `DEVICE`.

**Node configuration**

```json
{
"customerNamePattern": "Non-existent Customer",
"createCustomerIfNotExists": false
}
```

**State of the system**

- No customer named "Non-existent Customer" exists.
- Originator device is not assigned to any customer.

**Outgoing message**

The outgoing message is identical to the incoming one. Routed via the `Failure` connection.

**Result**

The processing fails with an error because the target customer doesn't exist and `createCustomerIfNotExists` is false.

### Example 6 — Reassigning from one customer to another

**Incoming message**

Originator: `ENTITY_VIEW`.

**Node configuration**

```json
{
"customerNamePattern": "New Customer",
"createCustomerIfNotExists": false
}
```

**State of the system**

- "Old Customer" and "New Customer" both exist under the tenant.
- Originator entity view is currently assigned to "Old Customer".

**Outgoing message**

The outgoing message is identical to the incoming one. Routed via the `Success` connection.

**Result**

The entity view is reassigned from "Old Customer" to "New Customer".
Loading