Skip to main content

Condition Schema

Use the Condition Input Field to create complex logic for your Triggers and Actions.

This guide explains how to define a custom JSON-based condition schema that can be used to generate query strings for different platforms (e.g., MySQL, JavaScript, Shopify Search Syntax).


Overview​

A custom condition schema allows your condition component to:

  • Convert user input (e.g. field, operator, value, logical connector) into a platform-specific query string.
  • Support multiple platforms or query languages through schema variants.

Each top-level object in the schema represents one supported platform or language.


Schema Example​

{
"name": "JavaScript",
"operators": {
"equals": {
"label": "Equals",
"value": "{{field}} === {{value}}"
},
"not_equals": {
"label": "Not Equals",
"value": "{{field}} !== {{value}}"
},
"less_than": {
"label": "Less Than",
"value": "{{field}} < {{value}}"
},
"less_than_or_equal": {
"label": "Less Than or Equal",
"value": "{{field}} <= {{value}}"
},
"greater_than": {
"label": "Greater Than",
"value": "{{field}} > {{value}}"
},
"greater_than_or_equal": {
"label": "Greater Than or Equal",
"value": "{{field}} >= {{value}}"
},
"contains": {
"label": "Contains",
"value": "{{field}}.includes({{value}})"
},
"not_contains": {
"label": "Does Not Contain",
"value": "!{{field}}.includes({{value}})"
},
"starts_with": {
"label": "Starts With",
"value": "{{field}}.startsWith({{value}})"
},
"ends_with": {
"label": "Ends With",
"value": "{{field}}.endsWith({{value}})"
}
},
"logicalOperators": {
"and": {
"label": "AND",
"value": "&&"
},
"or": {
"label": "OR",
"value": "||"
}
},
"multiConditionFormat": "({{conditions}})",
"singleConditionFormat": "{{operator}}"
}

Schema Fields Explained​

name​

Human-readable name of the platform (e.g., MySQL, Shopify). Used in label in the UI and logs.

operators​

Defines available comparison operators. There are two approaches. Choose the one that best fits your platform’s syntax.

Standard (full pattern per operator)​

When operators require unique structures, include the full expression pattern in each operator's value:

"operators": {
"contains": {
"label": "Contains",
"value": "{{field}}.includes({{value}})"
},
"starts_with": {
"label": "Starts With",
"value": "{{field}}.startsWith({{value}})"
}
}
"singleConditionFormat": "{{operator}}"

Simplified (single template pattern)​

When all operators follow a consistent pattern (like field operator value), you can simply define only the operator symbol and use singleConditionFormat to structure the expression:

"operators": {
"equals": {
"label": "Equals",
"value": "="
},
"not_equals": {
"label": "Not Equals",
"value": "<>"
},
"greater_than": {
"label": "Greater Than",
"value": ">"
}
},
"singleConditionFormat": "{{field}} {{operator}} {{value}}"

logicalOperators​

  • Defines how logical connectors like AND or OR should be expressed in the query string.
  • Typically AND and OR are consistent across many SQL‐like languages, but this may differ for other platforms.
"logicalOperators": {
"and": { "label": "AND", "value": "&&" },
"or": { "label": "OR", "value": "||" }
}

multiConditionFormat​

Format used to group multiple conditions.

"multiConditionFormat": "({{conditions}})"

This wraps all nested conditions in parentheses — useful for SQL-like languages.

singleConditionFormat​

Specifies the format for a single condition expression.

Examples:

  • For MySQL, {{field}} {{operator}} {{value}} might become title LIKE 'myValue'.
  • For Shopify, it might become title:myValue.

Adding More Platforms​

To add another platform, replicate the same structure:

{
"name": "Postgres",
"operators": {
"equals": {
"label": "Equals",
"value": "="
}
// more operators...
},
"logicalOperators": {
"and": {
"label": "AND",
"value": "AND"
}
// more logical operators...
},
"multiConditionFormat": "({{conditions}})",
"singleConditionFormat": "{{field}} {{operator}} {{value}}"
}