Conditional Logic

You can perform conditional logic in the formulas. This is done using the syntax

${BOOLEAN CONDITION ? If true, DO THIS : Else, DO THIS}

Boolean condition means any condition that evaluates to true or false. The question mark (?) indicates the end of the condition. If the condition is true, expressions to left of the (:) are evaluated. If the condition is false, the expression to the right of the (:) are evaluated. You could nest the conditions. This means that the 'If true' and 'If false' blocks could themselves be conditions.

The formula below will check if the actual cost of a project exceeds 90% of its estimated cost and would print 'Cost Alert!' if it exceeds and 'Cost OK' if it does not.
${entity.actualCost > (entity.estCost * .9) ? Cost Alert! : Cost OK}

 

Example of an nested condition :

${
  entity.risk_impact == 1 ? 'High' : ' ' || 
  entity.risk_impact == 2 ? 'Normal' : ' ' || 
  entity.risk_impact == 3 ? 'Low' : ' '
}

This formula will print High if the task's impact is 1, similarly Normal when 2 and Low when 3. 

 

Using custom fields created by you
You can use custom fields created by you in formulas as well. You have to use the 'Formula Key' to refer to them. This is the unique 'key' that you define when defining a custom field. In the above example, Risk_Impact is a formula key of a custom field defined by a user.

To find the formula key, refer here.