compareContext

This action compares one variable or expression in Context to another. Argument var is parsed as a TWIG-expression. Action emits true or false as a result intent. By default it returns false, unless one of optional conditions become true:

  • is_equal: checks if var is equal to this argument. TWIG is NOT parsed.
  • is_equal_var: checks if var is equal to parsed result of this argument. That contains a twig expression.

Example if is_equal:

actions:
  - compareContext:
      var: '{{a + 2}}'
      is_equal: 5
next:
  'true': Happens when a=3
  'false': All other situations

Example of is_equal_var:

actions:
  - compareContext:
      var: '{{a + 2}}'
      is_equal: '{{b}}'
next:
  'true': Happens when a = b - 2
  'false': All other situations

These conditions can be combined together, and act as an OR-condition.


Written by Andrey Esaulov on 12 March 2019

Updated on 12 March 2019