> For the complete documentation index, see [llms.txt](https://docs.aisera.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aisera.com/aisera-platform/ai-automation-optimize-flow/ai-workflow-studio/building-workflows/using-workflow-actions/custom-table-actions.md).

# Custom Table Actions

Each of the following Actions is discussed in this topic:

* [Delete Custom Table Records](#delete-custom-table-records)
* [Get Custom Table Records](#get-custom-table-records)
* [Update/Insert Records in Custom Table](#update-insert-records-in-custom-table)

***

#### Delete Custom Table Records

**Description:** Deletes one or more records from a custom table based on specified criteria or identifiers. The deletion is permanent and cannot be undone. Use with caution and ensure proper backup procedures are in place if necessary.

**Configuration Parameters:** This action has no configuration parameters.

**Input:**

* **tableId (String, Required):** The ID of the custom table from which records should be deleted.
* **payload (String, Required):** A JSON string containing the deletion criteria or record identifiers. The structure should specify which records to delete (e.g., by ID or filter conditions).
* **botId (Long, Optional):** The bot or application ID associated with this action. If not provided, the bot ID from the execution context is used.

**Output:**

* **success (Boolean):** A boolean flag indicating whether the delete operation was successful (`true`) or failed (`false`).
* **response (String):** The raw response as a string, including the number of deleted records and status messages.
* **mapResponse (Map):** The response parsed as a map, providing structured access to deletion results and confirmation data.

***

#### Get Custom Table Records

**Description:** Retrieves records from a custom table with optional filtering and pagination. Supports SQL-like WHERE clause filtering for advanced queries and maximum record count limits. Useful for retrieving specific or paginated data sets from custom tables.

**Configuration Parameters:** This action has no configuration parameters.

**Input:**

* **tableId (String, Required):** The ID of the custom table from which to retrieve records.
* **maxRecordCount (String, Optional):** The maximum number of records to return. Defaults to `100` if not specified.
* **filter (String, Optional):** A SQL-equivalent WHERE clause to filter records (e.g., `status=active AND priority>5`). If not specified, all records are returned subject to `maxRecordCount`.
* **botId (Long, Optional):** The bot or application ID associated with this action. If not provided, the bot ID from the execution context is used.

**Output:**

* **success (Boolean):** A boolean flag indicating whether the retrieve operation was successful (`true`) or failed (`false`).
* **response (String):** The raw response as a string, containing the retrieved records.
* **mapResponse (Map):** The response parsed as a map, providing structured access to the records and pagination metadata.

***

#### Update/Insert Records in Custom Table

**Description:** Updates or inserts records into a custom table. If a record with the same identifier exists, it will be updated; otherwise, a new record will be created.

**Configuration Parameters:** This action has no configuration parameters.

**Input:**

* **tableId (String, Required):** The ID of the custom table in which to update or insert records.
* **payload (String, Required):** A JSON string containing the record data to update or insert. The structure must conform to the custom table schema.
* **botId (Long, Optional):** The bot or application ID associated with this action. If not provided, the bot ID from the execution context is used.

**Output:**

* **success (Boolean):** A boolean flag indicating whether the update/insert operation was successful (`true`) or failed (`false`).
* **response (String):** The raw response as a string, including status messages or error details.
* **mapResponse (Map):** The response parsed as a map, providing structured access to response fields and data.
