Skip to main content

SmartFilters & SmartFormulas

SmartFields give you the values in your flow – the customer's number, the response status code, the line amount. SmartFilters and SmartFormulas are how you act on those values: ask a yes/no question, or compute a number.

  • A SmartFilter is a boolean expression. It answers a yes/no question. The Decision step's Condition, the Find Records step's Smart Filter – both are SmartFilters.
  • A SmartFormula is a math expression. It produces a number. You drop one inside a text field by wrapping it in [[ … ]], and the result replaces the placeholder when the step runs.

Both pick up SmartField tokens ({{customer.no}}, {{httpRequest.statusCode}}, …) the same way every other configuration field does. The token is resolved first; the operator or formula then runs on the resolved text or number.

SmartFilters

A SmartFilter is a single boolean expression made up of comparisons, joined with & (AND) and | (OR), with ! for negation and ( ) for grouping.

Comparison operators

Use these between two values – each side can be a literal, a SmartField token, or a quoted string.

OperatorReads asExampleTrue when
=equals{{httpRequest.statusCode}} = 200both sides are equal
!=not equal{{customer.blocked}} != ''the values differ
>greater than{{order.total}} > 1000left is strictly greater
<less than{{stock.qty}} < 5left is strictly less
>=greater or equal{{order.total}} >= 1000left is greater or equal
<=less or equal{{stock.qty}} <= 5left is less or equal
~contains{{description}} ~ 'urgent'right value appears anywhere in left
^=starts with{{customer.no}} ^= 'C0'left begins with right
$=ends with{{file.name}} $= '.pdf'left ends with right

Numbers vs. text. Comparisons (=, !=, >, <, >=, <=) check both sides numerically when both parse as numbers, otherwise they fall back to text comparison. So {{order.total}} >= 1000 works whether the SmartField resolves to 1000 or 1.000,50. {{customer.name}} = 'Adatum' works because both sides are text.

The empty string. Use two single quotes – '' – to mean "empty". {{customer.blocked}} != '' is the idiomatic "is the customer blocked?".

Combining conditions

OperatorReads asExample
&AND{{order.total}} >= 1000 & {{customer.country}} = 'DE'
|OR{{customer.priority}} = 'A' | {{order.urgent}} = true
!NOT!({{customer.blocked}} = '')
( )grouping({{a}} = 1 | {{a}} = 2) & {{b}} != ''

! always sits in front of a parenthesised group: !(…). There is no operator-precedence inside a single expression beyond what the parentheses say – when in doubt, add parentheses.

A few full examples

{{httpRequest.statusCode}} = 200

Did the request succeed?

{{customer.blocked}} != '' & {{order.total}} > 0

The customer is blocked and the order isn't empty.

{{file.name}} $= '.pdf' | {{file.name}} $= '.PDF'

Filename ends with .pdf (case-sensitive – cover both spellings, or normalise upstream).

!({{salesHeader.status}} = 'Released')

Anything except a released sales document.

Tips

  • Quote text values. Wrap literal text in single quotes ('DE', 'Released'). Numeric and boolean literals don't need quotes.
  • Keep it short. If the expression is hard to read, push the work into a Parser step that builds a clean boolean SmartField, and let the Decision/Find Records step reference that field.
  • Strings are case-sensitive. Match the casing the data actually has, or normalise both sides through a Parser step first.

SmartFormulas

A SmartFormula is a small math expression you drop inline into any text field by wrapping it in [[ … ]]. AutoFlow evaluates the expression, formats the result, and substitutes the whole [[ … ]] block with the formatted number.

The general shape is:

[[expression]]
[[expression;format]]

The optional ;format clause picks a specific Business Central format string. Leave it off (or write a bare ;) and you get the default rendering – AutoFlow uses <Standard Format,9> under the hood, which is locale-neutral (decimal point, no thousand separators).

Operators

OperatorDoesExample
+add[[2 + 3;]]5
-subtract[[10 - 4;]]6
*multiply[[{{order.total}} * 0.19;]]
/divide[[{{order.total}} / {{order.lines}};]]
%modulo (remainder)[[7 % 3;]]1
^power[[2 ^ 8;]]256
( )grouping[[(1 + 2) * 3;]]9

Functions

FunctionDoesExample
max(a, b)larger of two values[[max({{order.total}}, 100);]]
min(a, b)smaller of two values[[min({{quote}}, {{cap}});]]
abs(a)absolute value[[abs({{difference}});]]
round(value, decimals)round to N decimals (banker's)[[round({{order.total}} * 1.19, 2);]]
floor(value, decimals)round down to N decimals[[floor({{order.total}}, 0);]]
ceil(value, decimals)round up to N decimals[[ceil({{order.total}}, 0);]]

round, floor, and ceil take a decimals argument: 2 rounds to two decimals (12.34712.35), 0 rounds to whole numbers, negative values round to tens / hundreds (-2 → nearest hundred).

The format string

The part after the ; is a standard BC format string – the same one you'd pass to Format(value, 0, '<format>') in AL. A few useful shapes:

FormatResult for 1234.5
(omitted or empty)1234.5
<Precision,2:2>1234.50
<Sign><Integer Thousand><Decimals,3>1,234.500

For most cases, leaving the format off ([[…]]) is fine – you get a locale-neutral decimal rendering. Reach for a format string only when you need precision control, thousand separators, or a specific layout.

Examples

The total with VAT is [[{{order.total}} * 1.19;]] EUR.

Plain inline calculation.

Net: [[{{order.total}};<Precision,2:2>]] EUR
Tax: [[round({{order.total}} * 0.19, 2);<Precision,2:2>]] EUR

Two formulas in one block of text, both formatted to two decimals.

Buffer days: [[max({{daysLeft}} - 2, 0);]]

Never go below zero.

Tips

  • Don't quote numbers. Formulas only see numbers – {{order.total}} resolves to the number, not to text. If a SmartField resolves to text that looks like a number, it works; if it resolves to non-numeric text, the formula breaks.
  • One formula = one number. If you need a calculation that depends on a yes/no decision, use a Decision step or a Parser step to pick the right value first, then drop the SmartField into the formula.
  • Use parentheses freely. Multiplication and division bind tighter than addition and subtraction, but parentheses are the easy way to be sure of the intent.

Where they show up

StepFieldType
DecisionConditionSmartFilter
Find RecordsSmart FilterSmartFilter

SmartFormulas can appear inline in any text-accepting field on a step configuration – descriptions, URLs, request bodies, parser inputs, error messages, and so on. Wherever a SmartField token ({{ … }}) is allowed, a SmartFormula block ([[ … ; ]]) is allowed too.