How to Use Autocomplete Search in Custom Data?
Autocomplete search allows users to quickly find needed records by selecting from unique values stored in the database. The user selects from unique values that are saved to their constant.
When Needed
- You need to allow users to select values from existing records in a table.
- You need to create a cascading search (each subsequent selection depends on the previous one).
- You need to simplify data entry by offering ready options.
What's Important to Know
- Autocomplete search — search block that shows unique values from a model column.
- The user selects from unique values that are saved to their constant.
- You can use multiple search blocks sequentially — each subsequent one considers the selection in the previous one.
- After selecting all values, use the
custom_modules__getaction to get the record.
Prerequisites
You are logged in with integrator or administrator rights. There is a created Custom Data model with records and unique values in the system. You have access to the scenario constructor.
Step-by-Step Instructions
Configuring Search Block
- Go to the bot's scenario constructor.
- Add a "Search with Autocomplete" block (or similar block for searching in Custom Data).
- In block settings, specify configuration (JSON):
{
"module_name": "textile",
"field": "collection"
}
module_name— model name (for example, "textile", "product", "customer")field— column name from which unique values are selected (for example, "collection", "category", "brand")
- Save changes in the block.
Cascading Search (Multiple Blocks Sequentially)
If you need to use multiple search blocks sequentially:
- Add the first search block with the first-level field (for example, "collection").
- Add the second search block with the second-level field (for example, "color").
- Each subsequent block automatically considers the selection in the previous one, filtering available options.
- After selecting all values, add an "Action" block with the
custom_modules__getfunction to get the full record.
Getting Record After Search
- After selecting values in search blocks, add an "Action" block.
- Select the
custom_modules__getfunction. - Configure parameters to get the record (see instruction "How to Use custom_modules__get Action").
Usage Example
Cascading search scenario:
- Search block →
module_name: "textile",field: "collection"→ user selects collection - Search block →
module_name: "textile",field: "color"→ user selects color (selected collection is considered) - "Action" block with
custom_modules__get→ gets full record with all fields
What Happens After
After selecting values in search blocks, selected values are saved to user constants. After using custom_modules__get, the full record becomes available for use in subsequent scenario blocks.
How to Verify It Worked
- Check that the search block is configured with the correct model name and field.
- Make sure the model has unique values for the selected field.
- Test the scenario and check that the user sees a list of unique values.
- Check that after selecting a value, it is saved to the constant.