# Organizations

The component **Organizations** allows managing company records in the system, enabling **creation, updating, removal and association of contacts** to an organization.

### 📂 **Available Operations**

Here are the operations that can be performed with this component:

| Operation                                 | Description                                                                    |
| ----------------------------------------- | ------------------------------------------------------------------------------ |
| **Create** (`create`)                     | Creates a new organization.                                                    |
| **Update** (`update`)                     | Updates the data of an existing organization.                                  |
| **Create or Update** (`create_or_update`) | If the organization exists, update; if it does not exist, create a new record. |
| **Delete** (`delete`)                     | Removes an organization from the system.                                       |
| **Get all** (`get_all`)                   | Gets a list of all registered organizations.                                   |
| **Get linked people** (`get_persons`)     | Returns all people associated with an organization.                            |
| **Add people** (`add_persons`)            | Adds one or more people to an organization.                                    |
| **Remove people** (`remove_persons`)      | Removes one or more people from an organization.                               |

***

### 🎯 **How to Configure an Operation**

#### 1️⃣ **Access the Component**

* In **Hablla Studio**, open the automation flow where you want to include the action.
* Add the block **"Organizations"**.
* In **right side panel**, configure the desired operation.

***

### 📝 **Operation Details**

#### **1. Create Organization**

💡 **What does it do?**\
This operation allows creating a new organization record in the system.

🔹 **Required fields:**

* **Organization name**
* **CNPJ (if applicable)**

🔹 **Optional fields:**

* **About** (Organization description)
* **Address**
* **Phones**
* **Emails**
* **Organization owner**
* **Custom tags**

✅ **Step by step:**

1. Choose the operation **"Create"**.
2. Fill in the required and optional fields.
3. Click on **Save** ✅.

***

#### **2. Update Organization**

💡 **What does it do?**\
Updates the information of an existing organization.

🔹 **Required fields:**

* **Organization ID** (can be retrieved from another step of the automation).

✅ **Step by step:**

1. Choose the operation **"Update"**.
2. Enter the organization ID and the fields to be changed.
3. Click on **Save** ✅.

***

#### **3. Create or Update Organization**

💡 **What does it do?**\
Checks if the organization already exists:

* If **exists**, **updates the data**.
* If **does not exist**, **creates a new record**.

✅ **Step by step:**

1. Choose the operation **"Create or Update"**.
2. Fill in the organization's data.
3. Define the **identification rule**:
   * **Oldest** (keeps the first record).
   * **Most recent** (keeps the most up-to-date).
4. Click on **Save** ✅.

***

#### **4. Delete Organization**

💡 **What does it do?**\
Permanently removes an organization from the system.

🔹 **Required fields:**

* **Organization ID**

✅ **Step by step:**

1. Choose the operation **"Delete"**.
2. Provide the organization ID.
3. Confirm the action and click **Save** ✅.

***

#### **5. Get All Organizations**

💡 **What does it do?**\
Retrieves a list of all registered organizations.

🔹 **Optional filters:**

* **Search by name**
* **CNPJ**
* **Status (active, inactive, etc.)**
* **Tags**
* **Linked user**

✅ **Step by step:**

1. Choose the operation **"Find All"**.
2. Apply filters, if necessary.
3. Click on **Save** ✅.

***

#### **6. Get People Linked to an Organization**

💡 **What does it do?**\
Gets the list of people associated with an organization.

🔹 **Required fields:**

* **Organization ID**

✅ **Step by step:**

1. Choose the operation **"Get People"**.
2. Enter the organization ID.
3. Click on **Save** ✅.

***

#### **7. Add People to an Organization**

💡 **What does it do?**\
Links one or more people to an organization.

🔹 **Required fields:**

* **Organization ID**
* **IDs of the people to be added**

✅ **Step by step:**

1. Choose the operation **"Add People"**.
2. Enter the organization ID and the people IDs.
3. Click on **Save** ✅.

***

#### **8. Remove People from an Organization**

💡 **What does it do?**\
Removes one or more people from an organization.

🔹 **Required fields:**

* **Organization ID**
* **IDs of the people to be removed**

✅ **Step by step:**

1. Choose the operation **"Remove People"**.
2. Enter the organization ID and the people IDs.
3. Click on **Save** ✅.

***

### ⚙️ **Filters and Customizations**

In addition to the basic operations, you can apply **filters** and **add custom fields**:

✅ **Available search filters:**

* **Full name**
* **CNPJ**
* **Status**
* **Tags**
* **Organization owner**
* **Custom fields**

✅ **Customizable fields:**

* **Emails**
* **Addresses**
* **Phones**
* **Tags**
* **Responsible users**

***

### 🚀 **Usage Example in an Automation Flow**

📌 **Scenario:** Do you want to create a flow where a new lead is registered and automatically linked to an organization.

1. **Block 1** → Create a new **Lead**.
2. **Block 2** → Search the organization by **CNPJ**.
3. **Block 3** → If the organization exists, **add the person**.
4. **Block 4** → If the organization does not exist, **create it automatically**.

Result: 📊 **The organization will always be up to date and associated with the right leads!**

***

### 📌 **Conclusion**

The component **Organizations** allows **to create, manage and associate contacts with companies** within Hablla Studio. With the right automations, you can **optimize segmentation and ensure an efficient sales flow**.

If you need more support, contact our team! 🚀


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hablla.com/hablla-docs-en/automation-flows/all-components/hablla/organizations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
