How to Use custom_modules__get Action to Get a Record?
The custom_modules__get action searches for a record in a Custom Data table by values from user state variables and saves it to a variable. Used for finding existing records based on search criteria.
When Needed
- You need to find an existing record in a Custom Data table by certain criteria.
- You need to get data about a user or object from the database.
- You need to check if a record with certain values exists.
What's Important to Know
- custom_modules__get — action for searching and getting a record from Custom Data.
- Before use, you need to save field values for search in the user state.
- Search is performed by values from variables of type "model_name:field_name".
- After getting the record, you can output its attributes in a message block.
Prerequisites
You are logged in with integrator or administrator rights. There is a created Custom Data model with records in the system. You have access to the scenario constructor. You know which fields to search by.
Step-by-Step Instructions
Preparing Search Criteria
- In the scenario, add blocks to collect data to search by:
- "Wait for Response" — for entering search value
- "Message with Keyboard" — for selection from options
- Save the value to a variable of type "model_name:field_name" (for example,
customer:email,product:code).
Example: To search by the "email" field, save the value to the customer:email variable.
Configuring Action
- Add an "Action" block to the scenario after search criteria collection blocks.
- In the "Action" block settings, select the
custom_modules__getfunction. - In the configuration field (JSON), enter parameters:
{
"module_name": "customer",
"set_to": "customer"
}
module_name— name of the model with the custom table (for example, "customer", "product")set_to— name of the variable where the found record will be saved (for example, "customer", "found_product")
- Save changes in the action and scenario.
Using Retrieved Record
After getting the record, you can output its attributes in a message block using the variable from set_to. For example, if set_to = "customer", you can use {{customer:name}} or {{customer:phone}} to output field values.
Usage Example
Scenario:
- "Wait for Response" block → user enters email, saved to
customer:email - "Action" block with
custom_modules__get→ searches for record bycustomer:email, saves tocustomer - "Message" block → outputs
{{customer:name}}and{{customer:phone}}
Important Notes
- Before using
custom_modules__get, be sure to save field values for search in user state variables. - If the record is not found, the variable from
set_towill be empty. - You can use multiple fields for search simultaneously — the system will find a record that matches all criteria.
What Happens After
After executing the custom_modules__get action, the found record is saved to the variable specified in set_to. The record becomes available for use in subsequent scenario blocks. If the record is not found, the variable will be empty.
How to Verify It Worked
- Check that search values are saved to variables of type "model_name:field_name".
- Make sure the model name in
module_namematches an existing model. - Test the scenario and check that the record is found and saved to the variable.
- Check that record attributes are available for output.