# Advanced Custom Data Cases

Custom Data allows you to create not only simple tables (stores, ratings, requests) but also configure complex models: hide technical fields, add validation, charts, row highlighting, a map or image slider in the modal window. This article explains **when** to use these capabilities and **what cases** they cover.

**For whom:** integrators and administrators designing models for complex business processes.

---

## When Advanced Settings Are Needed

**Simple models** — basic field types (text, number, date, association) are enough. Examples: store list, C-SAT after dialog, callback requests.

**Complex models** — additional options are needed when:

- There are technical fields that should not clutter the table or be visible to operators
- Validation is required (required fields, email format, conditional field availability)
- Charts are needed (number of requests by status, sales total by category)
- Visualization is needed: map, image slider, row highlighting by status
- Table totals or file uploads are needed
- Need to run bot scenario processes directly from the table (macros) — e.g. send a reminder to the client

---

## Typical Complex Cases

### 1. Hide Technical Fields

**Case:** Model integrates with an external system. Field `external_system_id` is needed for sync, but operators don't need it.

**Solution:** `hidden_all` — field is hidden everywhere (table, modal, filters).

**Alternative:** `hidden_in_table` — column is hidden in columns chooser, but user can enable it for export.

---

### 2. Validation and Conditional Availability

**Case:** Model "Shifts" — end time is unavailable until start time is set. Email is required and must be valid.

**Solution:** `rules: ["required", "email"]` for email; `validate.required_field_empty` for end time — field is active only when "Start time" is filled.

---

### 3. Statistics Charts

**Case:** Model "Requests" — need to quickly see how many requests are in each status. Model "Sales" — total by managers.

**Solution:** `statistics_json` — chart "Count by status" (measure: count, group_by: status_id) or "Total by managers" (measure: sum, group_by: manager_id, sum_field: amount).

---

### 4. Row Color Highlighting

**Case:** Model "Requests" — rows with status "Overdue" in red, "Completed" in green. Operator quickly orients in the table.

**Solution:** `front_json.table_stylization.colorize` — highlight row by color from status field. Or `highlight_rules` — compare two fields (e.g., actual time vs planned).

---

### 5. Modal with Map and Slider

**Case:** Model "Stores" — when opening a record, need a map with address and photo slider of the store.

**Solution:** `front_json.modal_entity` — type: MAP for map, type: SLIDER for images from related model.

---

### 6. Table Totals

**Case:** Model "Sales" — need total for "Amount" column at bottom of table.

**Solution:** `total_sum: true` for field + `front_json.table_stylization.total_row`.

---

### 7. File Uploads

**Case:** Model "Requests" — attached documents (contracts, photos). Model "Stores" — logo.

**Solution:** Single file — STRING + `edit_type: file_upload`. Multiple files — JSON + `file_upload: true`.

---

### 8. Running Processes from Table (macros)

**Case:** Operator sees a table of requests and needs to quickly send a reminder to the client or create a ticket in an external system — without switching to another section.

**What macros are:** Macros are bot scenario sections marked as processes (is_macro). They appear in the selection list. You can create multiple macros in a scenario: "Send reminder", "Create ticket", etc.

**Solution:** In the model's `front_json.macros` set `bot_id` (ID of the bot with macros) and `single: true` (button in each row). A lightning button appears in the table. Operator clicks → selects a macro from the list → a widget with the bot opens; record data (id, fields) is passed to the scenario as context. Option `multiple: true` — button for bulk run on selected records.

**Where to configure:** Create/Update → Model JSON → `front_json.macros`. For details see the [advanced options reference](/en/customdata/reference/advanced-model-options-reference.md).

---

## Simple vs Complex Models

| Aspect | Simple models | Complex models |
|--------|---------------|----------------|
| **Example** | Stores, C-SAT, requests | Requests with charts, stores with map |
| **Fields** | Basic types (text, number, date, association) | + visibility, validation, conditional availability |
| **Table** | Standard display | + images, links, totals, highlighting |
| **Modal** | Standard form | + map, slider, chart, sections |
| **Statistics** | None or export | Charts in interface |
| **Table actions** | — | Macros — buttons to run bot processes |

---

## Where to Start

1. **Start simple** — create a model with basic fields. Ensure the structure matches business needs.
2. **Then add complexity** — if you need to hide fields, add validation, or charts, refer to the [advanced options reference](/en/customdata/reference/advanced-model-options-reference.md).
3. **Ask AI (Instance Agent)** — on the create-model screen, describe in text what you need (e.g., "chart by status"); the agent proposes structure via MCP. Then refine options in the editor.

---

## Related Documents

- [Advanced Model Options Reference](/en/customdata/reference/advanced-model-options-reference.md) — full list of options
- [Custom Data Patterns and Examples](/en/customdata/explanation/custom-data-patterns-and-examples.md) — typical scenarios (CRUD, catalogs, import)
- [What is Custom Data](/en/customdata/explanation/what-is-custom-data.md) — core concepts
- [Integrator — Custom Data](/en/customdata/integrator-hub.md) — navigation through all instructions
