As an organization grows, so does the complexity of its automation use cases. The expression builder node allows workflow designers to perform operations like adding numbers together, replacing a part of a string of text, comparing strings, manipulating date/date-time fields, and helping cater to these advanced automation needs.
Expression node
The expression builder node helps users,
Build complex expressions and perform String, Date, Numeric, and Logical operations on data within the workflow.
Build conditions based on expressions and use the results in subsequent workflow nodes.
How to use the Expression Node?
There are 4 sections in the Expression node:
Expected Output
Functions
Operators
Body
Placeholders
Test expression
Expected Output - The type of output that will be returned when the expression is evaluated. You can string together multiple functions and operators in a single expression, which will then be validated against the expected output.
Example: To calculate the due date of a ticket based on the joining date of an employee, the expected output in the expression node should be in Date format.
List of outputs supported
String
Number
Boolean (True/False)
Date
DateTime
Body - Construct expressions in the body section using the functions and operators supported below. You can also combine them with liquid filters.
Functions- The expression builder supports a whole host of functions that you can use to perform, date, string, mathematical, and logical operations on values from the workflow context.
Example: max(5, 10) where max is a function. Check out the list of functions supported by the expression builder node here
Note:
- Enclose the date and string values in quotes eg: ‘2022-01-02’, ‘Freshservice’.
- All expressions should use single quotes.
Operators- Operators let you define the mathematical operations or the logical comparisons to be performed. Check out the list of operators supported here.
Placeholder - Use the Placeholder section (+ icon) to insert values from the workflow context.
Note - Use ISO format while using date-based placeholders in expressions.
Test expression - Hit the Test Expression button to validate both the syntax and outputs of your expression. If your expression uses placeholders, you can use this section to replace them with sample values to evaluate the expression.