Portal Community

Conditional Action Config

// ConditionalActionConfig — if/then/else
{
  "type": "conditional",
  "condition": "{{ context.roles.includes('admin') }}",
  "then": {
    "type": "navigate",
    "target": "/admin/settings"
  },
  "else": {
    "type": "set-variable",
    "variable": "accessDeniedMsg",
    "value": "You need admin access to view settings."
  }
}

Condition Expression Syntax

The condition field uses the same {{ }} token syntax as widget config properties. The expression must evaluate to a boolean-like value:

ConditionEvaluates True When...
{{ context.roles.includes('admin') }}Current user has the admin role
{{ variables.selectedId !== null }}A row has been selected
{{ route.id !== undefined }}The URL has an id parameter
{{ variables.formIsValid }}The formIsValid variable is truthy
{{ variables.count > 0 }}Count variable is greater than zero

Conditional Inside a Chain

// Conditional step inside a chain — route to different outcomes
{
  "type": "chain",
  "actions": [
    { "type": "trigger-workflow", "processId": "check-approval", "waitForCompletion": true, "input": { ... } },
    {
      "type": "conditional",
      "condition": "{{ workflowOutput.approved }}",
      "then": {
        "type": "navigate",
        "target": "/success"
      },
      "else": {
        "type": "chain",
        "actions": [
          { "type": "set-variable", "variable": "rejectionReason", "value": "{{ workflowOutput.reason }}" },
          { "type": "navigate", "target": "/rejected" }
        ]
      }
    }
  ]
}

Common Patterns

Conditional vs. visibilityExpression

Use visibilityExpression on a widget to hide/show it entirely. Use conditional actions when the widget should always be visible but its click behavior should differ based on conditions. For example, a Delete button is always shown but its onClick uses a conditional to open an admin confirm dialog vs. showing a "no permission" message.