> ## Documentation Index
> Fetch the complete documentation index at: https://help.treble.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# CRM Object Block

> Read a property from a HubSpot contact, deal, company or ticket and save it into a variable to use it inside the conversation.

# CRM Object

The **CRM Object** block does the opposite of the CRM Action block: instead of writing to HubSpot, it **reads** a piece of data from HubSpot and saves it into a Treble variable. From there you can use it anywhere in the conversation.

With this you can, for example, greet the customer mentioning the amount of their latest quote, or send them down a different path depending on the stage their deal is in.

<Info>
  In the block menu, this block appears as **Assign variables**, with the description "Associate objects from contacts". Once you add it to the conversation, the block is called **CRM Object**. They are the same block.
</Info>

<Info>
  The **contact** properties are already available automatically as `hubspot_...` variables throughout the conversation. This block is mostly useful for reading properties of **deals, companies and tickets**, which are not loaded on their own. Check <a class="article-link" href="/en/docs/integrations/hubspot/features/variables"><p>HubSpot variables in Treble</p><Icon icon="arrow-up-right-from-square" iconType="solid" /></a>
</Info>

## Add the block to your conversation

1. Log in to <a class="article-link" href="https://app.treble.ai"><p>app.treble.ai</p><Icon icon="arrow-up-right-from-square" iconType="solid" /></a>
2. Go to **Create Conversation**
3. Click on the <Icon icon="square-plus" iconType="solid" /> button to display the block menu
4. Look for the **Assign variables** block and click on it to add it
5. Connect it at the point of the flow where you need the data, **before** the block that is going to use it
6. Double-click on the block to open its configuration

<Warning>
  The block has to go **before** the block where you use the variable. If you place it after, the variable will be empty when the message is sent.
</Warning>

<div class="hr" />

## Configure the block

<img src="https://mintcdn.com/trebleai/dcOwRe0FLklqGTic/images/hubspot-objeto-crm-configuracion.png?fit=max&auto=format&n=dcOwRe0FLklqGTic&q=85&s=1c88b812d1d967cb219a7d5e3b62284a" alt="CRM Object block configuration with object, hierarchy, property and variable name" width="2386" height="1358" data-path="images/hubspot-objeto-crm-configuracion.png" />

### 1. Select an object and its hierarchy

Just like in the CRM Action block, you choose which object you want to read from: **contact, deal, company or ticket**.

If you choose something other than the contact, you have to tell Treble **which** of the associated objects to use, through the hierarchy:

| Option            | What it does                                                     |
| ----------------- | ---------------------------------------------------------------- |
| **First created** | The oldest of the ones associated with the contact               |
| **Last created**  | The most recent of the ones associated with the contact          |
| **Custom**        | The one whose property is exactly equal to the value you specify |

The hierarchy works exactly the same as in the CRM Action block, including the behavior diagram. If you have doubts about which one to choose, check <a class="article-link" href="/en/docs/integrations/hubspot/blocks/crm-action"><p>CRM Action Block</p><Icon icon="arrow-up-right-from-square" iconType="solid" /></a>

### 2. Define the property that will be placed in the conversation

Select the property of the object whose value you want to bring into the conversation. For example, `Amount` for the amount of a deal, `Deal stage`, or the priority of a ticket.

### 3. Name the variable

In **Variable name** you write what the data will be called inside Treble. That is the name you will use between braces later on.

For example, if you name it `amount`, in the following blocks you will be able to write `{{amount}}`.

<Tip>
  Use lowercase names without spaces or accents, like `quote_amount` or `ticket_priority`. That way they are easier to remember and to type.
</Tip>

<div class="hr" />

## How the block looks in your conversation

Once configured, the block shows a summary of what it does directly on the canvas: the object, the hierarchy, the property it reads and the variable where it saves it.

<img src="https://mintcdn.com/trebleai/dcOwRe0FLklqGTic/images/hubspot-objeto-crm-nodo.png?fit=max&auto=format&n=dcOwRe0FLklqGTic&q=85&s=2a38016775bbabf6b678bd59efc6bba3" alt="CRM Object block on the canvas showing object, hierarchy, property and the resulting variable" width="1074" height="892" data-path="images/hubspot-objeto-crm-nodo.png" />

The variable appears already written between braces, ready to use. Click on the copy icon to its right and paste it into the block where you need it. That way you avoid typing errors.

<div class="hr" />

## What you can do with the variable

Once saved, the variable behaves like any other Treble variable:

* **Show it in a message:** "Your quote for `{{amount}}` is still valid."
* **Evaluate it in a conditional block:** send the customer down one path or another depending on the stage of their deal. Check <a class="article-link" href="/en/docs/integrations/hubspot/blocks/conditional"><p>Conditional Block</p><Icon icon="arrow-up-right-from-square" iconType="solid" /></a>
* **Reuse it in a CRM Action block:** read a piece of data from one object and write it into another.
* **Pass it to an AI agent** as conversation context.

<div class="hr" />

## Use cases

### Pick up a quote without asking about it

You read the amount and the stage of the contact's **last created deal**, and you open the conversation with that data. The customer feels you are talking about their case, not about a template.

### Route support based on ticket priority

You read the priority of the ticket associated with the contact and, with a conditional block, you send high priority cases straight to a human agent and the rest to the AI agent.

### Personalize the offer based on the company

You read the size or the industry of the **company** associated with the contact and use that information to decide which plan to show them.

<div class="hr" />

## If something does not work

### The variable comes in empty

1. **Does the contact have that object associated?** If the contact does not have any deal associated in HubSpot, there is nothing to read.
2. **Did the hierarchy leave everything out?** With "Custom", if no object meets the exact condition, the variable remains empty.
3. **Is the block before the one that uses the variable?** This is the most common cause.
4. **Does the property have a value in HubSpot?** Open it in HubSpot and confirm it.

### I typed the variable name wrong

Use the copy button of the block on the canvas instead of typing it by hand. Copy the name exactly, braces included.

### I cannot find the property I want to read

Refresh the properties with the sync button. Check <a class="article-link" href="/en/docs/integrations/hubspot/features/properties"><p>HubSpot properties in Treble</p><Icon icon="arrow-up-right-from-square" iconType="solid" /></a>
