# Insert record

Inserting a record on your table means that you will create a new row on your table.

This means that you'll go from this:

| FullName | Email |
| -------- | ----- |
|          |       |

To that:

| FullName   | Email                  |
| ---------- | ---------------------- |
| **Agatha** | **<agatha@email.com>** |

## Insert a record

To insert a record on your table:

1. Make sure that you created a table with the appropriate structure. For this example, we will use a lead generation table that captures:&#x20;
   * **FullName:** Captures the lead's full name.
   * **Email:** Stores the lead's email address.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FVuz4WAtZVuDYTig8SYpl%2FScreenshot%202024-03-13%20at%2018.28.31.png?alt=media&#x26;token=08f97c43-a634-43f8-8e00-e223f7593b19" alt=""><figcaption><p>An example of table for lead generation</p></figcaption></figure>

2. Make sure that you capture the relevant variables in your conversation. In our example, we capture the user name and email in [Collect input](https://docs.chatlayer.ai/buildabot/flow-logic/dialog-state/user-input-bot-dialog) blocks. These are the variables that we want to add to our lead generation table, i.e. `customer_name` and `customer_email`.
3. [Add a Table operation](https://docs.chatlayer.ai/bot-answers/tables-beta/perform-operations-on-your-records#add-a-table-operation-to-your-flow) to your flow.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FvBIZBHMPVcKz0U9sbJNK%2FScreenshot%202024-03-13%20at%2018.29.56.png?alt=media&#x26;token=c7a4c1e9-e681-44dc-9b06-3789745e0fb2" alt=""><figcaption><p>Add a Table operation to your flow.</p></figcaption></figure>

4. Select **Insert Record.**

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FXi2mBcrnO2QG2n6Snwak%2FScreenshot%202024-03-12%20at%2021.17.29.png?alt=media&#x26;token=e500a3c7-ffc4-47f0-b5cb-98dbeba02343" alt="" width="375"><figcaption><p>Select the Insert record table operation</p></figcaption></figure>

5. Select the table that you'd like to work on. For this example, we called our table **Lead generation**.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FxsReGIIKomUkqDqKJ6s6%2FScreenshot%202024-03-13%20at%2018.32.00.png?alt=media&#x26;token=6ca04533-fd5b-4926-89af-18838c7bdf7f" alt="" width="375"><figcaption><p>Select your table.</p></figcaption></figure>

6. To recall, our example lead generation table has 2 columns: `FullName` and `Email`. Under **Operation Config**, link the **FullName** field to be populated with the variable {`customer_name}.`
7. Do the same for **Email** and {customer\_email}.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FwrMtzRIzhH4T7s57KrAv%2FScreenshot%202024-03-15%20at%2011.42.05.png?alt=media&#x26;token=94bcdf91-b91d-499f-97c2-9e9f4cb41f92" alt=""><figcaption><p>Insert a record to your table.</p></figcaption></figure>

8. Click **Save**.
9. Test your bot in the emulator. Run through your bot flow within the emulator to simulate the user experience and trigger the **Insert record** action.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FEB0PZ6MMJ7ZKFMMJ4YUP%2FScreenshot%202024-03-18%20at%2012.16.21.png?alt=media&#x26;token=6a9291b8-b7f2-4a06-842c-afd336e802fb" alt="" width="375"><figcaption></figcaption></figure>

10. After testing, navigate to your table to confirm that the lead's information has been accurately recorded and stored.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FiqDGVORDonGOGv19HHhl%2FScreenshot%202024-03-18%20at%2012.16.56.png?alt=media&#x26;token=66d8cbaf-9d08-4df9-a2c2-703ab6eeebd1" alt=""><figcaption></figcaption></figure>

***

{% hint style="success" %}
Looking for a quick and easy bot template to play with Tables? The [Gym bot](https://docs.chatlayer.ai/start-quickly/bot-templates/gym) is a representative use case.
{% endhint %}
