Skip to content
© 2026 The ThingsBoard Authors
Try for free

ThingsBoard Cloud

Choose your data region

Your data stays in the region you choose, for residency and compliance. No credit card required.

Rather run it yourself? Install on your own servers

Check Relation Presence

Use this node to branch processing based on whether a relation exists between the message originator and another entity. For example, you can check whether a device Contains a specific asset before triggering an action, or verify that any Manages relation exists from the originator before applying a policy.

  • Direction — required. The direction of the relation relative to the message originator: From originator or To originator.
  • Relation type — required. The type of relation to match (e.g., Contains, Manages).
  • Check relation to specific entity — toggle.
    • Enabled: the node checks for a relation matching the configured direction and type that points to a specific entity. Two additional fields appear:
      • Type — required. The entity type of the target (e.g., DEVICE, ASSET, CUSTOMER).
      • Entity selector — required. Select the specific target entity by name.
    • Disabled: the node checks for any relation matching the configured direction and type, regardless of the target entity.
  1. If Check relation to specific entity is enabled:
    1. Search for a direct relation that matches the configured direction, type, and target entity.
    2. If found, route via True; otherwise, route via False.
  2. If Check relation to specific entity is disabled:
    1. Search for any direct relation that matches the configured direction and type.
    2. If at least one matching relation exists, route via True; otherwise, route via False.
Connection Condition
True A matching relation was found.
False No matching relation was found.
Failure An unexpected error occurred during processing.

Example 1 — Relation to specific entity exists → True

Section titled “Example 1 — Relation to specific entity exists → True”
{
"direction": "FROM",
"relationType": "Contains",
"checkForSingleEntity": true,
"entityType": "ASSET",
"entityId": "8c67e3b0-1234-4e9a-9b8c-781be214172f"
}

State: a Contains relation exists from the originator to the specified asset.

Result: True.


Example 2 — Relation to specific entity does not exist → False

Section titled “Example 2 — Relation to specific entity does not exist → False”
{
"direction": "FROM",
"relationType": "Manages",
"checkForSingleEntity": true,
"entityType": "ASSET",
"entityId": "3b4f2d90-7891-4b2d-88d7-d3cfb90ec501"
}

State: no Manages relation from the originator to the specified asset.

Result: False.


Example 3 — Any matching relation exists → True

Section titled “Example 3 — Any matching relation exists → True”
{
"direction": "FROM",
"relationType": "Connected",
"checkForSingleEntity": false
}

State: the originator has at least one Connected relation in the FROM direction.

Result: True.


Example 4 — No matching relation → False

Section titled “Example 4 — No matching relation → False”
{
"direction": "TO",
"relationType": "Contains",
"checkForSingleEntity": false
}

State: no Contains relations in the TO direction exist for the originator.

Result: False.


Example 5 — Multi-level relation is not considered → False

Section titled “Example 5 — Multi-level relation is not considered → False”
{
"direction": "FROM",
"relationType": "Contains",
"checkForSingleEntity": true,
"entityType": "DEVICE",
"entityId": "de305d54-75b4-431b-adb2-eb6b9e546013"
}

State: the originator has a Contains relation to an intermediate asset, which in turn has a Contains relation to the target device — but no direct relation from the originator to the device.

Result: False — only direct relations are checked.

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "TbCheckRelationNodeConfiguration",
"type": "object",
"additionalProperties": false,
"required": ["direction", "relationType", "checkForSingleEntity"],
"properties": {
"direction": {
"type": "string",
"description": "Direction of the relation relative to the originator.",
"enum": ["FROM", "TO"]
},
"relationType": {
"type": "string",
"description": "Type of the relation to match."
},
"checkForSingleEntity": {
"type": "boolean",
"description": "When true, the relation must match a specific target entity."
},
"entityType": {
"type": "string",
"description": "Type of the target entity. Required if 'checkForSingleEntity' is true."
},
"entityId": {