← Help Center

Using Conditional Logic in Your Deformity

Logic in Deformity allows you to control the behavior and flow of your forms using simple, plain English instructions.

Depending on whether you are using AI-guided forms or static forms, the way you implement logic will vary. This guide explains both methods to help you create dynamic, responsive forms.


Using Logic with AI-guided Forms

With AI-guided forms, you simply write what you want in plain English. As the form progresses, when it reaches a point where logic applies, the AI evaluates your instructions and decides the next steps dynamically. This means you can describe complex conditional behavior in natural language without having to code intricate logic rules.

Example of AI-guided logic in Deformity

For instance, you might instruct: "If the user is over 18, ask for consent; otherwise, end the conversation." The AI interprets this instruction and handles the flow accordingly.

You can also redirect users to specific websites based on an answer. The wording matters—using the word redirect usually works best. If the form doesn’t behave as expected, try rephrasing your logic.

Example of using logic to redirect from a multiple choice question
If store is Amazon, redirect to amazon.com.
If store is Walmart, redirect to walmart.com.
If store is Costco, redirect to costco.com.
If store is Smith's redirect to smiths.com.
If other, ask why and move on.

When a user chooses one of these options, they are immediately sent to the corresponding link. If you prefer to show a confirmation screen first, include a confirmation statement letting them know the form is about to redirect.

Referencing Previous Answers in Redirects

You can insert answers that the user has already provided directly into a redirect URL. Just wrap the question label in square brackets. For example:

Example of using variables to redirect to a URL with existing data passed in
If store is Amazon, immediately redirect to amazon.com?name=[THEIR NAME]&email=[THEIR EMAIL].

When this logic runs, [THEIR NAME] and [THEIR EMAIL] will be replaced with the respondent’s actual answers. You can reference any previous field the same way, letting you pass data to external pages or apps without writing extra code.

Tips for Optimizing AI-guided Logic

If something isn't working correctly with your AI logic, it likely means the instructions need to be reworded. The more specific and concise your instructions, the better the AI tends to follow them.

The AI can be quite sensitive to wording. If a rule isn’t firing, try rephrasing it in a few different ways—shorten the sentence, swap verbs (e.g., "redirect" vs. "send"), or explicitly name the choice you’re checking. Small tweaks often make the logic click into place.

For example, if you have a multiple choice question presenting four names (like above), you might simply state: "If Florida, skip the next question". This direct instruction helps prevent confusion.

In general, shorter AI forms tend to perform logic more accurately because they are less likely to be confused by too many or overly complex instructions.

Using Markdown in Logic

You can include markdown syntax directly inside your logic blocks. This lets you show custom buttons or links when a condition is met.

Add markdown in your logic block

For example:

If they say yes, show them this link:
[Add to your calendar](https://www.google.com/calendar/event?action=TEMPLATE&dates=5/11/2025%2F5/12/2025&text=TITLE&location=Salt%20Lake&details=best%20event%2%20of%20the%20year)

When this logic runs, the user will see a clickable button that links to your calendar event.

Add a custom link to your form via markdown in logic

If you have further questions or feedback, please reach out to support@deformity.ai for assistance.