Contact Free trial Login

Choice Router XML Reference

A Choice flow control component follows the structure described below.

  • A single root element <choice>

  • A <when> child element for each routing option, each with an expression to match.

  • Optionally, an <otherwise> child element of choice, that handles all cases where none of the expressions on the <when> elements evaluate to True.

  • Components that are conditionally executed under each of the choices are defined as child elements of the when and otherwise elements.

Properties of <when>

Property Description

Expression (expression)

Expression in DataWeave language to evaluate input. If the expression evaluates to true, this routing option is used.

Business Events

For activating the Business Events feature.

<choice doc:name="Choice">
  <when expression="#[vars.language == 'french']">
    <set-payload value="Bonjour!" doc:name="Reply in French"/>
  </when>
  <when expression="#[vars.language == 'spanish']">
    <set-payload value="Hola!" doc:name="Reply in Spanish"/>
  </when>
  <otherwise >
    <set-variable variableName="language" value="English" doc:name="Set Language to English"/>
    <set-payload value="Hello!" doc:name="Reply in English"/>
  </otherwise>
</choice>

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub