This article demonstrates the use of formula mode in Quickwork Journey Builder.
What you'll need:
Skill level: Intermediate
Time required: 3 minutes
- Skills of specifying a ternary condition for the input fields
You can conditionally execute formulas using Ruby's ternary syntax (popular shortcut for if-else statements). Ternary syntax is of the form:
condition ? expression1 : expression2
Behavior
condition:
A boolean expression that evaluates to true
or false
.
expression1:
Returns this expression if the condition is true
.
expression2:
Returns this expression if the condition is false
.
Conditional formula example
In the following example, we conditionally pass in either the Full name
or First name
into the Message input field:
Here is a detailed explanation of what the ternary formula does:
Full name.present?
will check if theFull Name
pill has a value. If it has a value, it evaluates totrue
. If it has no value, it evaluates tofalse
.- The second
?
in the formula separates the condition to evaluate from the expressions to return. - If there is a value in the
Full Name
pill when the job is run, the value forFull Name
will be mapped to the Message input. - If there is no value in the
Full Name
pill when the job is run, the value forFirst Name
will be mapped to the Message input. Of course, if there's also no value in thisFirst Name
pill, the job will fail at this step, as Message is a required input field.
For more information on Ruby's ternary syntax, check out this article.
Comments
0 comments
Please sign in to leave a comment.