Lodol Docs

Built-in Functions

Pure, stateless built-in functions available in every Lodol workflow expression.

Built-in Functions

Built-in functions are pure, stateless helpers that are evaluated directly inside the workflow expression engine. They require no external credentials and are available in every workflow.

Built-ins are referenced in the workflow AST using their kind discriminant. The tables below list each function, its AST node fields, return type, and a usage example.


Text

LowerCase

Convert a string to lowercase.

FieldTypeDescription
kind"LowerCaseBuiltIn"Node discriminant
valueexpressionString to convert

Returns: string

{
  "kind": "LowerCaseBuiltIn",
  "value": { "kind": "Literal", "value": "Hello World" }
}

Result: "hello world"


UpperCase

Convert a string to uppercase.

FieldTypeDescription
kind"UpperCaseBuiltIn"Node discriminant
valueexpressionString to convert

Returns: string

{
  "kind": "UpperCaseBuiltIn",
  "value": { "kind": "Literal", "value": "hello world" }
}

Result: "HELLO WORLD"


Capitalize

Uppercase the first character and lowercase the rest.

FieldTypeDescription
kind"CapitalizeBuiltIn"Node discriminant
valueexpressionString to capitalize

Returns: string

{
  "kind": "CapitalizeBuiltIn",
  "value": { "kind": "Literal", "value": "hello world" }
}

Result: "Hello world"


TitleCase

Title-case every word in a string (whitespace preserved).

FieldTypeDescription
kind"TitleCaseBuiltIn"Node discriminant
valueexpressionString to title-case

Returns: string

{
  "kind": "TitleCaseBuiltIn",
  "value": { "kind": "Literal", "value": "hello world" }
}

Result: "Hello World"


TextLength

Count the number of characters in a string.

FieldTypeDescription
kind"TextLengthBuiltIn"Node discriminant
valueexpressionString to measure

Returns: number

{
  "kind": "TextLengthBuiltIn",
  "value": { "kind": "Literal", "value": "hello" }
}

Result: 5


StartsWith

Check whether a string begins with a given prefix.

FieldTypeDescription
kind"StartsWithBuiltIn"Node discriminant
stringexpressionThe string to test
prefixexpressionThe prefix to look for

Returns: boolean

{
  "kind": "StartsWithBuiltIn",
  "string": { "kind": "Literal", "value": "https://example.com" },
  "prefix": { "kind": "Literal", "value": "https" }
}

Result: true


EndsWith

Check whether a string ends with a given suffix.

FieldTypeDescription
kind"EndsWithBuiltIn"Node discriminant
stringexpressionThe string to test
suffixexpressionThe suffix to look for

Returns: boolean

{
  "kind": "EndsWithBuiltIn",
  "string": { "kind": "Literal", "value": "report.pdf" },
  "suffix": { "kind": "Literal", "value": ".pdf" }
}

Result: true


TextContains

Check whether a string contains a given substring.

FieldTypeDescription
kind"TextContainsBuiltIn"Node discriminant
stringexpressionThe string to search within
substringexpressionThe substring to find

Returns: boolean

{
  "kind": "TextContainsBuiltIn",
  "string": { "kind": "Literal", "value": "Welcome to Lodol" },
  "substring": { "kind": "Literal", "value": "Lodol" }
}

Result: true


Replace

Replace all occurrences of a substring within a string.

FieldTypeDescription
kind"ReplaceBuiltIn"Node discriminant
stringexpressionThe source string
searchexpressionSubstring to find
replaceexpressionReplacement string

Returns: string

{
  "kind": "ReplaceBuiltIn",
  "string": { "kind": "Literal", "value": "foo bar foo" },
  "search": { "kind": "Literal", "value": "foo" },
  "replace": { "kind": "Literal", "value": "baz" }
}

Result: "baz bar baz"


Split

Split a string into an array by a delimiter.

FieldTypeDescription
kind"SplitBuiltIn"Node discriminant
stringexpressionThe string to split
delimiterexpressionDelimiter string

Returns: string[]

{
  "kind": "SplitBuiltIn",
  "string": { "kind": "Literal", "value": "a,b,c" },
  "delimiter": { "kind": "Literal", "value": "," }
}

Result: ["a", "b", "c"]


Truncate

Truncate a string to a maximum length, appending an ellipsis if the string was shortened.

FieldTypeRequiredDescription
kind"TruncateBuiltIn"YesNode discriminant
stringexpressionYesThe string to truncate
lengthexpressionYesMaximum number of characters (non-negative integer)
ellipsisexpressionNoString appended when truncated (defaults to "…")

Returns: string

{
  "kind": "TruncateBuiltIn",
  "string": { "kind": "Literal", "value": "Hello, world!" },
  "length": { "kind": "Literal", "value": 5 },
  "ellipsis": { "kind": "Literal", "value": "..." }
}

Result: "Hello..."


IsURL

Return true if the string is a valid http or https URL with no whitespace.

FieldTypeDescription
kind"IsURLBuiltIn"Node discriminant
valueexpressionString to validate

Returns: boolean

{
  "kind": "IsURLBuiltIn",
  "value": { "kind": "Literal", "value": "https://skipflow.com" }
}

Result: true


IsEmail

Return true if the string is a valid email address.

FieldTypeDescription
kind"IsEmailBuiltIn"Node discriminant
valueexpressionString to validate

Returns: boolean

{
  "kind": "IsEmailBuiltIn",
  "value": { "kind": "Literal", "value": "user@example.com" }
}

Result: true


Lists

Length

Return the number of items in an array.

FieldTypeDescription
kind"LengthBuiltIn"Node discriminant
valueexpressionArray to measure

Returns: number

{
  "kind": "LengthBuiltIn",
  "value": { "kind": "Literal", "value": [1, 2, 3] }
}

Result: 3


ListContains

Return true if any element in the list is deeply equal to value.

FieldTypeDescription
kind"ListContainsBuiltIn"Node discriminant
listexpressionArray to search
valueexpressionValue to look for

Returns: boolean

{
  "kind": "ListContainsBuiltIn",
  "list": { "kind": "Literal", "value": ["a", "b", "c"] },
  "value": { "kind": "Literal", "value": "b" }
}

Result: true


IndexOf

Return the zero-based index of the first element deeply equal to value, or -1 if not found.

FieldTypeDescription
kind"IndexOfBuiltIn"Node discriminant
listexpressionArray to search
valueexpressionValue to find

Returns: number

{
  "kind": "IndexOfBuiltIn",
  "list": { "kind": "Literal", "value": ["a", "b", "c"] },
  "value": { "kind": "Literal", "value": "c" }
}

Result: 2


Slice

Return a sub-array from start (inclusive) to end (exclusive). Both indices must be non-negative integers and within bounds.

FieldTypeDescription
kind"SliceBuiltIn"Node discriminant
listexpressionSource array
startexpressionStart index (inclusive, non-negative integer)
endexpressionEnd index (exclusive, non-negative integer)

Returns: array

{
  "kind": "SliceBuiltIn",
  "list": { "kind": "Literal", "value": [10, 20, 30, 40, 50] },
  "start": { "kind": "Literal", "value": 1 },
  "end": { "kind": "Literal", "value": 4 }
}

Result: [20, 30, 40]


Sort

Return a sorted copy of the array. Supports mixed types using Lodol's comparison order: null < boolean < number < string < array < object.

FieldTypeDescription
kind"SortBuiltIn"Node discriminant
valueexpressionArray to sort

Returns: array

{
  "kind": "SortBuiltIn",
  "value": { "kind": "Literal", "value": [3, 1, 2] }
}

Result: [1, 2, 3]


Reverse

Return a reversed copy of the array.

FieldTypeDescription
kind"ReverseBuiltIn"Node discriminant
valueexpressionArray to reverse

Returns: array

{
  "kind": "ReverseBuiltIn",
  "value": { "kind": "Literal", "value": [1, 2, 3] }
}

Result: [3, 2, 1]


Append

Return a new array with value appended to the end. The original array is not mutated.

FieldTypeDescription
kind"AppendBuiltIn"Node discriminant
listexpressionSource array
valueexpressionValue to append

Returns: array

{
  "kind": "AppendBuiltIn",
  "list": { "kind": "Literal", "value": [1, 2] },
  "value": { "kind": "Literal", "value": 3 }
}

Result: [1, 2, 3]


Insert

Return a new array with value inserted at index. The index must be between 0 and length (inclusive).

FieldTypeDescription
kind"InsertBuiltIn"Node discriminant
listexpressionSource array
indexexpressionPosition to insert at (integer)
valueexpressionValue to insert

Returns: array

{
  "kind": "InsertBuiltIn",
  "list": { "kind": "Literal", "value": [1, 3] },
  "index": { "kind": "Literal", "value": 1 },
  "value": { "kind": "Literal", "value": 2 }
}

Result: [1, 2, 3]


RemoveAt

Return a new array with the element at index removed. The index must be within bounds.

FieldTypeDescription
kind"RemoveAtBuiltIn"Node discriminant
listexpressionSource array
indexexpressionIndex of the element to remove (integer)

Returns: array

{
  "kind": "RemoveAtBuiltIn",
  "list": { "kind": "Literal", "value": ["a", "b", "c"] },
  "index": { "kind": "Literal", "value": 1 }
}

Result: ["a", "c"]


RemoveDuplicates

Return a new array with duplicate values removed (stable order, deep equality).

FieldTypeDescription
kind"RemoveDuplicatesBuiltIn"Node discriminant
valueexpressionArray to deduplicate

Returns: array

{
  "kind": "RemoveDuplicatesBuiltIn",
  "value": { "kind": "Literal", "value": [1, 2, 1, 3, 2] }
}

Result: [1, 2, 3]


RandomSample

Return up to count randomly selected unique elements from the list (deep-copied).

FieldTypeDescription
kind"RandomSampleBuiltIn"Node discriminant
listexpressionSource array
countexpressionNumber of elements to sample (non-negative integer)

Returns: array

{
  "kind": "RandomSampleBuiltIn",
  "list": { "kind": "Literal", "value": ["a", "b", "c", "d"] },
  "count": { "kind": "Literal", "value": 2 }
}

Result: e.g. ["c", "a"] (random)


Math

Round

Round a number to the nearest integer (ties round up).

FieldTypeDescription
kind"RoundBuiltIn"Node discriminant
valueexpressionFinite number to round

Returns: number

{
  "kind": "RoundBuiltIn",
  "value": { "kind": "Literal", "value": 2.5 }
}

Result: 3


Floor

Return the greatest integer less than or equal to the value.

FieldTypeDescription
kind"FloorBuiltIn"Node discriminant
valueexpressionFinite number

Returns: number

{
  "kind": "FloorBuiltIn",
  "value": { "kind": "Literal", "value": 2.9 }
}

Result: 2


Ceiling

Return the smallest integer greater than or equal to the value.

FieldTypeDescription
kind"CeilingBuiltIn"Node discriminant
valueexpressionFinite number

Returns: number

{
  "kind": "CeilingBuiltIn",
  "value": { "kind": "Literal", "value": 2.1 }
}

Result: 3


AbsoluteValue

Return the absolute value of a finite number.

FieldTypeDescription
kind"AbsoluteValueBuiltIn"Node discriminant
valueexpressionFinite number

Returns: number

{
  "kind": "AbsoluteValueBuiltIn",
  "value": { "kind": "Literal", "value": -42 }
}

Result: 42


Min

Return the minimum value in a non-empty array of finite numbers.

FieldTypeDescription
kind"MinBuiltIn"Node discriminant
valueexpressionNon-empty array of numbers

Returns: number

{
  "kind": "MinBuiltIn",
  "value": { "kind": "Literal", "value": [3, 1, 4, 1, 5] }
}

Result: 1


Max

Return the maximum value in a non-empty array of finite numbers.

FieldTypeDescription
kind"MaxBuiltIn"Node discriminant
valueexpressionNon-empty array of numbers

Returns: number

{
  "kind": "MaxBuiltIn",
  "value": { "kind": "Literal", "value": [3, 1, 4, 1, 5] }
}

Result: 5


Total

Return the sum of all numbers in an array. Returns 0 for an empty array.

FieldTypeDescription
kind"TotalBuiltIn"Node discriminant
valueexpressionArray of finite numbers

Returns: number

{
  "kind": "TotalBuiltIn",
  "value": { "kind": "Literal", "value": [10, 20, 30] }
}

Result: 60


Mean

Return the arithmetic mean of a non-empty array of finite numbers.

FieldTypeDescription
kind"MeanBuiltIn"Node discriminant
valueexpressionNon-empty array of numbers

Returns: number

{
  "kind": "MeanBuiltIn",
  "value": { "kind": "Literal", "value": [10, 20, 30] }
}

Result: 20


Mode

Return the most frequently occurring number in a non-empty array. Ties are broken by first appearance; if counts are equal the smaller first-seen index wins.

FieldTypeDescription
kind"ModeBuiltIn"Node discriminant
valueexpressionNon-empty array of numbers

Returns: number

{
  "kind": "ModeBuiltIn",
  "value": { "kind": "Literal", "value": [1, 2, 2, 3] }
}

Result: 2


RandomInteger

Return a random integer in the inclusive range [min, max].

FieldTypeDescription
kind"RandomIntegerBuiltIn"Node discriminant
minexpressionLower bound (integer)
maxexpressionUpper bound (integer, must be ≥ min)

Returns: number

{
  "kind": "RandomIntegerBuiltIn",
  "min": { "kind": "Literal", "value": 1 },
  "max": { "kind": "Literal", "value": 10 }
}

Result: e.g. 7 (random)


RandomReal

Return a random real number in [min, max). When min == max, returns min.

FieldTypeDescription
kind"RandomRealBuiltIn"Node discriminant
minexpressionLower bound (finite number)
maxexpressionUpper bound (finite number, must be ≥ min)

Returns: number

{
  "kind": "RandomRealBuiltIn",
  "min": { "kind": "Literal", "value": 0 },
  "max": { "kind": "Literal", "value": 1 }
}

Result: e.g. 0.6372 (random)


Date & Time

Now

Return the current UTC datetime as an ISO-8601 string with millisecond precision (e.g. "2025-06-01T12:00:00.000Z").

FieldTypeDescription
kind"NowBuiltIn"Node discriminant

Returns: string (ISO-8601)

{ "kind": "NowBuiltIn" }

Result: "2025-06-01T12:00:00.000Z" (current UTC time)


Today

Return today's local date as a YYYY-MM-DD string.

FieldTypeDescription
kind"TodayBuiltIn"Node discriminant

Returns: string

{ "kind": "TodayBuiltIn" }

Result: "2025-06-01"


Tomorrow

Return tomorrow's local date as a YYYY-MM-DD string.

FieldTypeDescription
kind"TomorrowBuiltIn"Node discriminant

Returns: string

{ "kind": "TomorrowBuiltIn" }

Result: "2025-06-02"


Yesterday

Return yesterday's local date as a YYYY-MM-DD string.

FieldTypeDescription
kind"YesterdayBuiltIn"Node discriminant

Returns: string

{ "kind": "YesterdayBuiltIn" }

Result: "2025-05-31"


UnixTimestamp

Return the current UTC Unix timestamp in whole seconds.

FieldTypeDescription
kind"UnixTimestampBuiltIn"Node discriminant

Returns: number

{ "kind": "UnixTimestampBuiltIn" }

Result: 1748779200


WeekdayName

Return the name of the weekday ("Sunday" through "Saturday") for a given ISO-8601 date string, evaluated in UTC.

FieldTypeDescription
kind"WeekdayNameBuiltIn"Node discriminant
dateexpressionISO-8601 date or datetime string

Returns: string

{
  "kind": "WeekdayNameBuiltIn",
  "date": { "kind": "Literal", "value": "2025-06-02" }
}

Result: "Monday"


TimeUntil

Return the number of whole seconds until the given ISO-8601 datetime (negative if in the past).

FieldTypeDescription
kind"TimeUntilBuiltIn"Node discriminant
dateexpressionISO-8601 date or datetime string

Returns: number

{
  "kind": "TimeUntilBuiltIn",
  "date": { "kind": "Literal", "value": "2025-12-31T23:59:59Z" }
}

Result: seconds remaining until that date


Wait

Pause workflow execution for the given number of seconds. Maximum duration is 86400 seconds (24 hours).

FieldTypeDescription
kind"WaitBuiltIn"Node discriminant
secondsexpressionPositive integer number of seconds (max 86400)

Returns: null

{
  "kind": "WaitBuiltIn",
  "seconds": { "kind": "Literal", "value": 30 }
}

IsHoliday

Return true if the given date is a public holiday in the specified region (defaults to "US"). Accepts ISO-8601 date strings or datetime strings.

FieldTypeRequiredDescription
kind"IsHolidayBuiltIn"YesNode discriminant
dateexpressionYesISO-8601 date or datetime string
regionexpressionNoISO 3166-1 alpha-2 country code (e.g. "US", "GB")

Returns: boolean

{
  "kind": "IsHolidayBuiltIn",
  "date": { "kind": "Literal", "value": "2025-12-25" },
  "region": { "kind": "Literal", "value": "US" }
}

Result: true


Validation

IsPhoneNumber

Return true if the string is a valid phone number for the given region (defaults to "US"). The region must be an ISO 3166-1 alpha-2 country code.

FieldTypeRequiredDescription
kind"IsPhoneNumberBuiltIn"YesNode discriminant
valueexpressionYesPhone number string to validate
regionexpressionNoISO 3166-1 alpha-2 country code (default "US")

Returns: boolean

{
  "kind": "IsPhoneNumberBuiltIn",
  "value": { "kind": "Literal", "value": "+14155552671" },
  "region": { "kind": "Literal", "value": "US" }
}

Result: true


Output

Display

Return a deep copy of the given value. Used to surface a value as a visible output in the workflow execution log.

FieldTypeDescription
kind"DisplayBuiltIn"Node discriminant
valueexpressionAny value to display

Returns: the same value (deep-copied)

{
  "kind": "DisplayBuiltIn",
  "value": { "kind": "Literal", "value": "Hello, world!" }
}

Result: "Hello, world!"

On this page