LOIS Workflows expressions let you dynamically reference data from previous workflow steps, perform calculations, and transform values. All expressions are written inside double curly braces: {{ expression }}. Statements in brackets will be evaluated as javascript.
Reference output from prior steps using step1.fieldName syntax, and access workflow variables using variables.myVariable syntax. Many functions can be chained together for powerful transformations.
- Quick Reference: What to Use What
- Date Functions: Add & Subtract Time
- Date Functions: Rounding
- Date Functions: Create, Format, & Parse
- String Functions
- Number & Math Functions
- Array Functions
- Type Conversion & Checking
- JSON Functions
- Conditional Operators
Examples:
"Hi, {{step1.firstName}} {{step1.lastName}}!" → "Hi, John Smith!"
"Due: {{step1.date.addDays(30).toString({ format: 'MM/DD/YYYY' })}}" → "Due: 03/15/2026"
"${{step4.sum + variables.estimatedTax}}" → "$110.52"
Quick Reference: When to Use What
| I want to… | Use this |
|---|---|
| Add or subtract time from a date | .addDays(n), .addMonths(n), etc. |
| Snap to the start of a day, week, or month | .beginningOfDay, .beginningOfMonth, etc. |
| Show a date in a specific style | .toString({ format: "MM/DD/YYYY", timezone: "..." }) |
| Convert a text date into a real date | .toDate("yyyy-MM-dd") |
| Get a clean standard date string | .toISOString() |
| Manipulate text values | .toUpperCase(), .replace(), .includes(), etc. |
| Do math or rounding | Math.round(), Math.max(), .toFixed(), etc. |
| Work with lists of items | .map(), .filter(), .find(), .reduce() |
| Handle missing or null values | ?? (nullish coalescing), || (or) |
| Choose between two values | ? : (ternary operator) |
Date Functions: Add & Subtract Time
Calculate due dates, reminders, or offsets like "30 days after submission." These can be chained together and always end with .toISOString() or .toString() to produce a usable result. Use negative numbers to subtract time (e.g. addDays(-7) for one week ago).
| Function | Example | Description |
|---|---|---|
| .addYears(n) | {{step1.date.addYears(1).toISOString()}} | Adds the specified number of years to a date |
| .addMonths(n) | {{step1.date.addMonths(2).toISOString()}} | Adds the specified number of months to a date |
| .addDays(n) | {{step1.date.addDays(30).toISOString()}} | Adds the specified number of days to a date |
| .addHours(n) | {{step1.date.addHours(4).toISOString()}} | Adds the specified number of hours to a date |
| .addMinutes(n) | {{step1.date.addMinutes(15).toISOString()}} | Adds the specified number of minutes to a date |
| .addSeconds(n) | {{step1.date.addSeconds(30).toISOString()}} | Adds the specified number of seconds to a date |
Date Functions: Rounding
Snap any date to the beginning of a time period. Useful when you only care about the day, week, or month — not the exact time. These do not require parentheses.
| Function | Example | Description |
|---|---|---|
| .beginningOfYear | {{step1.date.beginningOfYear.toISOString()}} | Snaps the date to January 1 at midnight |
| .beginningOfMonth | {{step1.date.beginningOfMonth.toISOString()}} | Snaps the date to the 1st of its month at midnight |
| .beginningOfWeek | {{step1.date.beginningOfWeek.toISOString()}} | Snaps the date to the start of its week (Sunday) |
| .beginningOfDay | {{step1.date.beginningOfDay.toISOString()}} | Snaps the date to midnight of that day |
| .beginningOfHour | {{step1.date.beginningOfHour.toISOString()}} | Snaps the date to the start of its hour |
Date Functions: Create, Format & Parse
Create new dates, format them for display, or convert text strings into real dates.
| Function | Example | Description |
|---|---|---|
| new Date() | {{new Date()}} | Creates a Date for the current date and time |
| new Date(value) | {{new Date(step1.dateStr)}} | Creates a Date from a string or timestamp value |
| .toISOString() | {{step1.date.toISOString()}} | Returns date as ISO 8601 string (e.g. "2026-01-15T...") |
| .toString({...}) | {{step1.date.toString({ format: "MM/DD/YYYY", timezone: "America/Denver" })}} | Formats a date with a custom pattern and timezone |
| .toDate(format) | {{"2024-01-15 12:30".toDate("yyyy-MM-dd HH:mm").toISOString()}} | Parses a text string into a real date using the given format |
| .getFullYear() | {{step1.date.getFullYear()}} | Returns the four-digit year |
| .getMonth() | {{step1.date.getMonth()}} | Returns the month (0–11, where 0 = January) |
| .getDate() | {{step1.date.getDate()}} | Returns the day of the month (1–31) |
| Date.now() | {{Date.now()}} | Returns current time as milliseconds since Jan 1, 1970 |
String Functions
Manipulate text values such as names, emails, codes, and descriptions.
| Function | Example | Description |
|---|---|---|
| .toUpperCase() | {{step1.name.toUpperCase()}} | Converts string to all uppercase letters |
| .toLowerCase() | {{step1.email.toLowerCase()}} | Converts string to all lowercase letters |
| .trim() | {{step1.input.trim()}} | Removes whitespace from both ends of a string |
| .includes(search) | {{step1.name.includes("Smith")}} | Returns true if the string contains the search value |
| .replace(old, new) | {{step1.phone.replace("-", "")}} | Replaces the first occurrence of a value with another |
| .split(separator) | {{step1.fullName.split(" ")}} | Splits a string into an array by the given separator |
| .substring(start, end) | {{step1.zip.substring(0, 5)}} | Returns part of a string between start and end indexes |
| .startsWith(search) | {{step1.code.startsWith("FV-")}} | Returns true if string begins with search value |
| .endsWith(search) | {{step1.file.endsWith(".pdf")}} | Returns true if string ends with search value |
| .concat(value) | {{step1.first.concat(" ", step1.last)}} | Joins two or more strings together |
| .length | {{step1.name.length}} | Returns the number of characters in a string |
Number & Math Functions
Perform calculations, rounding, and formatting on numeric values.
| Function | Example | Description |
|---|---|---|
| Math.round(n) | {{Math.round(step1.total)}} | Rounds to the nearest whole number |
| Math.floor(n) | {{Math.floor(step1.price)}} | Rounds down to the nearest whole number |
| Math.ceil(n) | {{Math.ceil(step1.hours)}} | Rounds up to the nearest whole number |
| Math.abs(n) | {{Math.abs(step1.balance)}} | Returns the absolute (positive) value |
| Math.min(a, b, ...) | {{Math.min(step1.a, step2.b)}} | Returns the smallest of the given values |
| Math.max(a, b, ...) | {{Math.max(step1.a, step2.b)}} | Returns the largest of the given values |
| Number(value) | {{Number(step1.quantity)}} | Converts a value to a number |
| parseInt(value) | {{parseInt(step1.input)}} | Parses a string and returns a whole number |
| parseFloat(value) | {{parseFloat(step1.amount)}} | Parses a string and returns a decimal number |
| .toFixed(digits) | {{step1.total.toFixed(2)}} | Formats a number with a fixed number of decimal places |
| Subtract | {{step1.value - step2.value}} | Subtracts one value from another; values can be variables or hard coded amounts |
| Addition | {{step1.value + step2.value}} | Add one value to another; values can be variables or hard coded amounts |
| Multiplication | {{step1.value * step2.value}} | Multiplies one value by another; values can be variables or hard coded amounts |
| Division | {{step1.value / step2.value}} | Divides one value by another; values can be variables or hard coded amounts |
Array Functions
Work with lists of items, such as collection items, contacts, or billing line items returned by API steps.
| Function | Example | Description |
|---|---|---|
| .map(fn) | {{step1.items.map(i => i.name)}} | Creates a new array by transforming each element |
| .filter(fn) | {{step1.items.filter(i => i.active)}} | Creates a new array with elements that pass a test |
| .find(fn) | {{step1.items.find(i => i.id == 5)}} | Returns the first element that passes a test |
| .includes(value) | {{step1.tags.includes("urgent")}} | Returns true if the array contains the value |
| .length | {{step1.items.length}} | Returns the number of elements in the array |
| .join(separator) | {{step1.names.join(", ")}} | Joins all array elements into a single string |
| .some(fn) | {{step1.items.some(i => i.overdue)}} | Returns true if at least one element passes the test |
| .every(fn) | {{step1.items.every(i => i.complete)}} | Returns true if all elements pass the test |
| .reduce(fn, init) | {{step1.items.reduce((s,i) => s + i.amt, 0)}} | Reduces array to a single value by accumulating |
| .forEach(fn) | {{step1.items.forEach(i => ...)}} | Executes a function for each array element |
Type Conversion & Checking
Convert between data types or check what type a value is.
| Function | Example | Description |
|---|---|---|
| String(value) | {{String(step1.count)}} | Converts a value to a string |
| Number(value) | {{Number(step1.input)}} | Converts a value to a number |
| Boolean(value) | {{Boolean(step1.flag)}} | Converts a value to true or false |
| typeof value | {{typeof step1.result}} | Returns the type as a string (e.g. "string", "number") |
| Array.isArray(value) | {{Array.isArray(step1.data)}} | Returns true if the value is an array |
JSON Functions
Convert between JSON strings and JavaScript objects.
| Function | Example | Description |
|---|---|---|
| JSON.parse(string) | {{JSON.parse(step1.raw)}} | Converts a JSON string into an object |
| JSON.stringify(value) | {{JSON.stringify(step1.data)}} | Converts an object into a JSON string |
Conditional Operators
Add logic and handle missing or null values in your expressions.
| Function | Example | Description |
|---|---|---|
| ? : (ternary) | {{step1.status == "active" ? "Yes" : "No"}} | Returns one value if true, another if false |
| || (or) | {{step1.nickname || step1.firstName}} | Returns the first truthy value |
| && (and) | {{step1.a && step1.b}} | Returns true only if both values are truthy |
| ?? (nullish) | {{step1.middle ?? ""}} | Returns the right value only if the left is null or undefined |
Comments
0 comments
Article is closed for comments.