Skip to main content
Workflow conditions accept JavaScript expressions wrapped in double curly braces(`{{ ... }}`) to dynamically evaluate logic. These expressions are enclosed in double curly braces (`{{ ... }}`) and evaluated at runtime. Expressions can access:
  • Data from previous steps ($json, $prev, etc.)
  • The loop context
  • Built-in functions and utility libraries
For example, this checks if a status is "active":
{{ $json["status"] === "active" }}
Expressions must be written as a single line of JavaScript. Multi-line code or variable declarations are not supported.

Expression inputs

You can access the following contextual data inside expressions:
TokenDescription
$jsonThe JSON object from the current or previous step
$prevData from the previous node
DateTimeUtility for working with dates and times (Luxon)
Example:
{{ $json.customer.subscription.status === "trialing" }}

Type conversion tip

Some values (such as “true” or “false”) are returned as strings. To ensure your conditions behave as expected, you can enable “Convert types where required” in the Condition node settings. Without type conversion:
{{ $json["isTrialActive"] }}
// Evaluates to string "true", which may not behave like a boolean
With type conversion enabled:
{{ $json["isTrialActive"] === "true" }}
Alternatively:
{{ Boolean($json["isTrialActive"]) }}

Example: Remove addon from a subscription

At the end of a billing period, remove a specific addon from a subscription if it exists.
  1. Run this workflow on a schedule or based on a billing-related event.
  2. Use the List Subscriptions action to retrieve active subscriptions.
  3. Use a loop node to iterate through the returned subscriptions.
  4. For each subscription, loop through its addons array.
  5. Condition Check
Use a Condition node to check if a specific addon is present:
{{ $json["addonId"] === "target-addon-id" }}
  1. Update Subscription
If the addon exists, update the subscription using the Update Subscription action:
  • Subscription ID: Pass from the previous loop context
  • Addons: Supply a filtered list that excludes the unwanted addon
Example using a transformation node before update:
const filteredAddons = $json["addons"].filter(addon => addon.addonId !== "target-addon-id");
return { addons: filteredAddons };
To remove all addons, pass an empty array: [].

Using Luxon for date manipulation

The DateTime object is available for date handling inside expressions.

Examples: get dates

Get today’s ISO date:
{{ DateTime.now().toISODate() }}
Get the number of months between two dates:
{{ DateTime.fromISO('2025-07-01').diff(DateTime.fromISO('2025-04-01'), 'months').toObject() }}
Multi-line code blocks and variable declarations are not allowed in expressions.

Invalid (multi-line code block)

{{
  let start = DateTime.fromISO('...');
  let end = DateTime.fromISO('...');
  return end.diff(start, 'days');
}}

Valid (single-line expression)

{{ DateTime.fromISO('2025-07-01').diff(DateTime.fromISO('2025-06-01'), 'days').toObject() }}

Example: Extract nested JSON values

If your input JSON contains nested fields, you can access them like this:
{{ $json["body"]["user"]["location"] }}
Or with optional chaining:
{{ $json?.body?.user?.location }}

Troubleshooting common issues

IssueSolution
Condition fails unexpectedlyEnable “Convert types where required” or check your type comparisons
Expression returns undefinedMake sure the key path is correct; use optional chaining (?.)
Cannot reference a valueConfirm the value exists in the current execution context ($json)
Date math errorsUse ISO-formatted strings and the DateTime library
I