Skip to main content

SmartControls

SmartFields give you the values in your flow, and SmartFormulas compute numbers from them. SmartControls are the next step up: they let a single text field decide what to include and repeat a block for every item in a list.

You write them inline, right inside any text field that already accepts SmartFields – an email body, an HTTP request body, a generated XML or JSON document. There are two:

  • {#if … #} – include a piece of text only when a condition is true.
  • {#for {{list}} #} – repeat a piece of text once for each element of a list.

The condition or list is resolved when the step runs, exactly like a SmartField token, and the control block expands into the final text.

\{#if … #} – conditional content

{#if <condition> #}shown when true{#else #}shown otherwise{#endif #}

The <condition> is a SmartFilter – the same yes/no expression you use in a Decision step, with the same operators (=, !=, >, ~, &, |, !, …). SmartField tokens inside the condition are resolved before it is evaluated.

You can chain alternatives with {#elseif … #} and provide a fallback with {#else #}. Every block ends with {#endif #}.

Dear customer, your order is {#if {{order.total}} >= 1000 #}a priority and ships today{#elseif {{order.total}} > 0 #}being prepared{#else #}on hold{#endif #}.

If you omit the {#else #} branch and no condition matches, the block simply produces nothing.

\{#for {{list}} #} – repeat for each item

{#for {{vendors}} #}<line>{{vendors.name}}</line>{#endfor #}

{{vendors}} is the list you want to walk – a collection SmartField such as the result of a Find Records step or a collection. Inside the loop you keep using the same name to reach each item's fields: {{vendors.name}}, {{vendors.no}}, and so on. There is no separate loop variable to invent – the SmartField picker already knows vendors, so it can complete {{vendors.name}} for you.

For the list above with two vendors, the block expands to:

<line>Alpha GmbH</line><line>Beta AG</line>

Numbering each item

Add [i] after the list to get a counter, and reference it with {{i}}. It starts at 1.

{#for {{vendors}}[i] #}{{i}}. {{vendors.name}}
{#endfor #}

Nesting

A loop can sit inside another. The inner list is reached through the current item of the outer loop – so to walk each vendor's bank accounts you iterate {{vendors.bankaccounts}}:

{#for {{vendors}} #}
{{vendors.name}}
{#for {{vendors.bankaccounts}} #}
{{vendors.bankaccounts.iban}}
{#endfor #}
{#endfor #}

Because the inner list binds to the outer item, you can only nest down a relationship (vendorsvendors.bankaccounts); you can't restart an unrelated list inside the loop.

Lines that hold only a control tag disappear

You can put each {#for #}, {#endfor #}, {#if #}, {#endif #} on its own line to keep a template readable. A line that contains only a control tag (plus spacing) is removed entirely from the output – it does not leave a blank line behind. So this template:

<vendors>
{#for {{vendors}} #}
<vendor>{{vendors.name}}</vendor>
{#endfor #}
</vendors>

produces tight output with no gaps:

<vendors>
<vendor>Alpha GmbH</vendor>
<vendor>Beta AG</vendor>
</vendors>

Lines that have real content next to a tag are kept as-is.

Tips

  • Conditions are SmartFilters. Anything you can write in a Decision step's condition works in a {#if #} – see SmartFilters for the full operator list. Quote text values ('DE'), and use '' for "empty".
  • Reuse the list's name inside the loop. {#for {{vendors}} #}{{vendors.name}}. Don't rename it – the same selector the picker offers is the one that works.
  • Mind the spacing. Spaces and line breaks inside a block are part of the output. Put structural tags on their own lines (they vanish) and keep the content lines indented the way you want them to appear.
  • Combine freely. SmartFields, SmartFormulas and SmartControls all work in the same field – a {#for #} block can contain {{tokens}}, [[formulas]] and nested {#if #} blocks.

Where they show up

SmartControls can appear inline in any text-accepting field on a step configuration – email bodies, HTTP request bodies, parser inputs, generated documents, and so on. Wherever a SmartField token ({{ … }}) is allowed, an {#if #} or {#for #} block is allowed too.