# Conditional logic

> Ask a question only when an earlier answer calls for it, and send each response to the WhatsApp account that should handle it.

Conditional logic keeps a form short for each respondent and sends each lead to the right person. It has two parts, both included in every form: questions that only show for some answers, and destination rules that choose which WhatsApp account receives the response.

## Conditional questions

Every question after the first has a **Logic** section. Set **Show this question** to **Only if…**, then pick:

1. an earlier question;
2. a condition;
3. the answers to match (one or more), or a number.

When the condition doesn't match, the question is hidden. A hidden question is never asked and never blocks the respondent, even if it is required. It isn't in the WhatsApp message and it isn't saved. A later question that depends on it reads its answer as blank.

A question has one condition, and it can only read a question above it, so the first question is always asked. **Always** turns the condition off.

### Conditions by type

| The earlier question is   | Conditions                                                                                                                  |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| Dropdown or Single choice | **is**, **is not**, **is answered**, **is left blank**                                                                      |
| Multiple choice           | **includes any of**, **includes all of**, **doesn't include**, **is answered**, **is left blank**                           |
| Number                    | **is**, **is not**, **is more than**, **is at least**, **is less than**, **is at most**, **is answered**, **is left blank** |
| Any other type            | **is answered**, **is left blank**                                                                                          |

Every condition except **is left blank** needs the earlier question to be answered. So **is not** “Checkup” doesn't match a respondent who skipped that question.

### Follow-up questions

On a choice question, **Add a follow-up question** lists its options. Pick one, such as **When they answer “Toothache”**, and a new question appears below, already set to show only for that answer.

### Editing a form with logic

- Renaming an option keeps every condition that uses it.
- Deleting an option, changing the **Answer Type** of a question others depend on, or deleting that question asks you first when it would change a condition, and says how.
- If you move a question below one that depends on it, the dependent question shows a note, and the form can't be published until the order is fixed. Drafts always save.

### What respondents see

On a step-by-step form, the welcome screen gives the number of questions as a range when it depends on the answers, like `4–5 questions · about 50s`, and the counter shows "Question 3" without a total. On an all-at-once form, questions appear and disappear as people answer.

## Conditional destination

The **Conditional Destination** card sends a response to a different WhatsApp account depending on an answer: one branch per city, one person per service, one team per language.

1. Add your questions first. A rule reads one of their answers.
2. Select **Add destination rule**.
3. Under **If**, pick a question, a condition and the answer, as for a conditional question.
4. Under **Send responses to**, enter a phone number or a username.
5. Optionally, give the rule a **Name**. Only you see it, next to each response.

How the rules work:

- They are checked from top to bottom, and the first one that matches is used. The arrows change the order.
- A response no rule matches goes to the **Default destination**, the account in **WhatsApp Delivery**. It is the last row of the card, **Otherwise**.
- A rule can read any question in the form. A question the respondent wasn't asked counts as unanswered.
- A form can have up to 10 rules, each with one condition.
- To publish, every rule needs a finished condition and a valid WhatsApp account. A rule that can't be read never matches, so the response moves on to the next rule or the default destination.

The respondent sees the same form and the same message whichever account it goes to. Rules cost nothing extra: they don't use [Smart Links](https://walink.com/docs/smart-links) destinations.

### Where each response went

With **Save form responses** on, every response records its destination. The responses table and its CSV get a **Destination** column, and a **Responses by Destination** card counts them over all time. A response keeps the rule's name even if you delete the rule later. Without saved responses, nothing records where a response went.

> [!TIP]
> Answer the form preview to test your rules: its **Open WhatsApp** opens the account they choose. Nothing you do in the preview is saved or counted.

## Example: Dental Sol

Dental Sol has two clinics and one form:

| #   | Question       | Type                                 | Logic                     |
| --- | -------------- | ------------------------------------ | ------------------------- |
| 1   | Full name      | Short text                           | Always                    |
| 2   | Clinic         | Single choice: Downtown, Mission Bay | Always                    |
| 3   | Visit type     | Single choice: Checkup, Toothache    | Always                    |
| 4   | Where it hurts | Paragraph                            | Only if Q3 is “Toothache” |
| 5   | Preferred date | Date                                 | Always                    |

**WhatsApp Delivery** is the Downtown desk, +1 (415) 555-0123. One destination rule, named Mission Bay desk, says: if Clinic is “Mission Bay”, send responses to +1 (415) 555-0142.

| Respondent picks       | Questions asked | Message goes to                            |
| ---------------------- | --------------- | ------------------------------------------ |
| Downtown, Checkup      | 1, 2, 3, 5      | +1 (415) 555-0123, the default destination |
| Mission Bay, Toothache | All five        | +1 (415) 555-0142, the Mission Bay desk    |

The welcome screen reads `4–5 questions · about 50s`, and each clinic gets only its own patients, with the pain already described for a toothache.
