---
title: "Use Case 7: Complaint in Custom Data"
description: "complaints model, custom_modules__set, confirmation with complaint number, success and error edges."
---

# Use Case 7: Complaint in Custom Data

**Level:** basic · **Modules:** Scenario Builder, Custom Data · **Action:** `custom_modules__set`

## Required permissions and access

| What you need | Where in the menu | Why |
|---------------|-------------------|-----|
| **Scenario Builder** | Menu → Scenario Builder | Collect text/phone, write to CD |
| **Custom Data** | Menu → Custom Data | Model `complaints` |

If a section is missing from the menu — check your account permissions or contact ConnectiveOne support.

## Business context

The customer leaves a complaint — the record goes into a Custom Data table with an ID for confirmation (“Your complaint №…”). This is the pattern for any forms: requests, inquiries, feedback without CSAT.

## Expected result

- Custom Data model `complaints` (fields `text`, `phone`, `status`).
- `custom_modules__set` creates a record; ID is available for customer confirmation (`{{complaint:id}}`).
- Edges **success** / **error** are handled — no silence.

## Flow architecture

```text
MessageKeyboard ("Leave a complaint") → WaitForInput (text) → WaitForInput (phone)
   → custom_modules__set
      ├─ success → “Complaint №{{complaint:id}} accepted”
      └─ error → “Could not save”
```

## Step-by-step implementation

### Step 0. Custom Data — model

Custom Data → **New model**:

| Field | Type | Alias / name |
|-------|------|--------------|
| Complaint text | text | `text` |
| Phone | phone | `phone` |
| Status | text or select | `status` (default `new`) |

**Model alias:** `complaints` — must match `module_name` in the action **exactly** (case matters).

---

### Step 1. MessageKeyboard — enter the flow

| Parameter | Value |
|-----------|-------|
| Text | “Want to leave a complaint?” |
| Button | “Yes” · `complaint_yes` |

**Edges:** → WaitForInput (complaint text).

---

### Step 2. WaitForInput — text and phone

**Node 1 — text**

| Parameter | Value | Why |
|-----------|-------|-----|
| messageText | “Describe the complaint” | |
| outputVariable | `complaints:text` | Format **`module:field`** for `custom_modules__set` |
| Validation | `none` or min characters | |

**Node 2 — phone**

| outputVariable | `complaints:phone` |
| Validation | `phone` |

**Edges:** chain → Action set.

---

### Step 3. Action — `custom_modules__set`

**What it does:** creates a **new** row in the `complaints` table from constants `complaints:*`.

| node_params | Value | Why |
|-------------|-------|-----|
| `module_name` | `complaints` | Model alias in Custom Data |
| `set_to` | `complaint` | Record object → `{{complaint:id}}`, `{{complaint:text}}` … |

You can also set `complaints:status` = `new` via a **Set** node or a previous WaitForInput.

**Edges:**

| Edge | Where | Why |
|------|-------|-----|
| **success** | MessageKeyboard “Thank you! Complaint number: **{{complaint:id}}**” | Customer has a reference |
| **error** | “Could not save the complaint” | Check model alias and fields |

---

### Step 4. Verification

1. Custom Data → module `complaints` — a new row appeared.
2. Runs → after success constants contain `complaint` with `id`.

## Acceptance criteria (self-check Runs)

- [ ] After success the customer sees complaint number `{{complaint:id}}`.
- [ ] A new row with text and phone appeared in Custom Data.
- [ ] Edges **success** and **error** are connected on the canvas.
- [ ] `module_name` = model alias `complaints` (case).
- [ ] outputVariable in format `complaints:field`.

## Common mistakes

| Symptom | Cause | What to do |
|---------|-------|------------|
| `__set` error | Wrong `module_name` or field | Match model alias and constants |
| No `complaint:id` | Wrong `set_to` | Check `set_to`: `complaint` |
| Bot “goes silent” | Edge **error** not connected | Connect error → MessageKeyboard |
| Row without phone | Phone validation rejected | Check format or Validation `none` |

## Related documentation

- [use-custom-modules-set](/en/customdata/how-to/use-custom-modules-set.md)
- [WaitForInput parameters](/en/scenariobuilder/reference/wait-for-input-parameters.md)
- [FAQ — Custom Data](/en/learn/implementer/training/reference/faq.md)
- Next: [Use Case 7b — CSAT/NPS](/en/learn/implementer/training/basic/use-case-07b-csat-nps.md)
