# Add to group

<div align="left"><img src="https://thingsboard.io/images/user-guide/rule-engine-2-0/pe/nodes/action-add-to-group.png" alt="image"></div>

Adds Message Originator Entity to [Entity Group](https://docs.tesenso.com/tesenso-iot-cloud/guides/entity-groups).

Following Message Originator types are allowed: **Customer**, **Asset**, **Device**.

Finds target Entity Group by group name pattern and then adds Originator Entity to this group. Will create new Entity Group if it doesn’t exist and **Create new group if not exists** is set to true.

Configuration:

![image](https://thingsboard.io/images/user-guide/rule-engine-2-0/pe/nodes/action-add-to-group-config.png)

* **Group name pattern** - can be set direct group name or pattern can be used, that will be resolved to the real group name using Message metadata.
* **Create new group if not exists** - if checked will create new entity group if it doesn’t exist.
* **Groups cache expiration time** - specifies maximum time interval is seconds allowed to store found entity group records. 0 value means that records will never expire.

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

* When Originator entity type is not supported.
* Target entity group doesn’t exist and **Create new group if not exists** is unchecked.

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