Endflow and Redirection
The endflow component controls what happens when a form flow finishes—such as redirecting the user to a specific page, item, or closing a modal. You can set endflow globally for the entire form or within a specific trigger.
When to Use
Use endflow to define what should happen after a form is completed, either for the whole form or for specific triggers (e.g., after a certain action).
How It Works
- Global Endflow: Placed at the root of the form JSON, applies to the entire form.
- Trigger-Specific Endflow: Placed inside a trigger, overrides the global endflow for that trigger.
- If no endflowis set, the form will automatically choose an action (see Default Behavior).
Default Behavior (If No Endflow Defined)
- Redirect to the first predefined item in the Items Array (if available).
- Redirect to a newly created item from the form's triggers.
- Redirect to the starting item (the item on which the form was initiated).
- Redirect to the dashboard (fallback).
Global Endflow
Define at the root of your form JSON. Applies to the entire form unless overridden by a trigger.
Options:
- redirect: (string) The redirection target. See Endflow Commands.
- redirect_uri: (string) Used with- redirect: "uri"to specify a custom URI.
- closeModal: (boolean) If true, closes the modal after form completion. Ignores other endflow commands.
Example:
{
  "endflow": {
    "redirect": "item"
  }
}
This redirects the user to the starting item after form completion.
Trigger-Specific Endflow
Set inside a trigger to override the global endflow for that action.
Options:
- endflow: (boolean) Ends the form when the trigger is activated.
- endflow_redirect: (string) Redirection target for this trigger (see Endflow Commands).
- closeModal: (boolean) Closes the modal after this trigger. Ignores other endflow commands.
- relevantForItems: (JSON Query) See JSON Query. Determines which items are relevant for the endflow. If not set, all items are considered relevant.
Example:
{
  "submit": {
    "triggers": [
      {
        "then": {
          "endflow": true,
          "endflow_redirect": "itemkey.item1"
        }
      }
    ]
  },
  "endflow": {
    "redirect": "uri",
    "redirect_uri": "/item/12345"
  }
}
In this example, the trigger ends the form and redirects to item1. The global endflow would redirect to a specific URI if the trigger is not used.
Endflow Commands
Use these values for redirect or endflow_redirect to control navigation:
- back: Return to the previous page (useful in multi-page forms).
- dashboard: Redirect to the dashboard (main menu).
- item: Redirect to the starting item (the item the form was started from).
- uri: Redirect to a custom URI (must set- redirect_uri). Only available in global endflow.
- itemkey.[item]: Redirect to a specific item defined in the form's flow. Replace- [item]with the unique item key.
- closeModal: Close the modal after form completion (can be used as a property or as a command).
Usage Examples
Redirect to Previous Page
{
  "endflow": {
    "redirect": "back"
  }
}
Redirect to Dashboard
{
  "endflow": {
    "redirect": "dashboard"
  }
}
Redirect to Starting Item
{
  "endflow": {
    "redirect": "item"
  }
}
Redirect to a Specific URI
{
  "endflow": {
    "redirect": "uri",
    "redirect_uri": "/specific-path"
  }
}
Redirect to a Specific Item by Key
{
  "endflow": {
    "redirect": "itemkey.newItem"
  }
}
Close Modal on Completion
{
  "endflow": {
    "closeModal": true
  }
}