# related Device attributes

![](https://111806075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mg4otljWU9FsHKYhTsW%2Fuploads%2FzWYmqZIoJN9pCRm4FCiG%2Fimage.png?alt=media\&token=5b79ada7-16d4-4315-b727-b51b01f40f1e)

Node finds Related Device of the Message Originator entity using configured query and adds Attributes (client\shared\server scope) and Latest Telemetry value into Message Metadata.

Attributes are added into metadata with scope prefix:

* shared attribute -> `shared_`
* client attribute -> `cs_`
* server attribute -> `ss_`
* telemetry -> no prefix used

For example, shared attribute ‘version’ will be added into Metadata with the name ‘shared\_version’. Client attributes will use ‘cs\_’ prefix. Server attributes use ‘ss\_’ prefix. Latest telemetry value added into Message Metadata as is, without prefix.

In ‘Device relations query’ configuration Administrator can select required **Direction** and **relation depth level**. Also **Relation type** can be configured with required set of **Device types**.

<div align="left"><img src="https://thingsboard.io/images/user-guide/rule-engine-2-0/nodes/enrichment-device-attributes-config.png" alt="image"></div>

If multiple Related Entities were found, ***only the first Entity is used*** for attributes enrichment, other entities will be discarded.

**Failure** chain is used if no Related Entity was found, otherwise - **Success** chain.

If attribute or telemetry was not found, it is not added into Message Metadata and still routed via **Success** chain.

Outbound Message Metadata will contain configured attributes only if they exist.

To access fetched attributes in other nodes you can use this template ‘`metadata.temperature`’

{% hint style="info" %}
**Note:** the rule node has the ability to enable/disable reporting **Failure** if at least one selected key doesn’t exist in the outbound message.
{% endhint %}

<div align="left"><img src="https://111806075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mg4otljWU9FsHKYhTsW%2Fuploads%2FM4HBgBT2UNIj0UJVR0ez%2Fimage.png?alt=media&#x26;token=621e448a-28e2-4e4b-8fa2-85c8f34934da" alt=""></div>
