JEXL Functions: Strings
Function Reference
This section lists the non-entity JEXL helper functions currently available in tSM configuration. Entity calls such as crm.customer.find(...) are covered separately in the Public API section.
Strings
toString(value)
Converts a value to a string.
Behavior:
nullandundefinedare returned unchanged,- arrays and objects are converted using
JSON.stringify, - primitive values are converted using
.toString().
toString(123)
// '123'
toString({ a: 1 })
// '{"a":1}'
replaceDoubleQuotesToSingle(value)
Replaces all double quotes with single quotes.
replaceDoubleQuotesToSingle('"hello"')
// ''hello''
Practical use:
replaceDoubleQuotesToSingle(toString($context.form.payload))
replace(value, search, replacement)
Replaces all occurrences of a substring using split(search).join(replacement).
replace('A-B-C', '-', '/')
// 'A/B/C'
If the input string is falsy, it returns null.
substring(text, start, end)
Extracts part of a string. It behaves like JavaScript substring.
'abcdef'.substring(1, 4)
// 'bcd'
Helper form:
substring($context.form.code, 0, 3)