Formula - replace
Section titled “ Formula - replace”The replace Formula function returns the content with every occurrence of oldValue replaced by newValue.

Animated walkthrough: on the Order Received JSON of the Order-to-Cash demo, replace('ORD-', '', jsonPath('$.orderId', body)) removes the prefix from ORD-10005 and returns 10005.
Syntax
Section titled “ Syntax”replace('oldValue', 'newValue', content)Parameters
Section titled “Parameters”| Parameter | Required | Description |
|---|---|---|
'oldValue' |
Yes | The text to find. It's matched as plain text, not as a pattern, and case-sensitive: 'order' doesn't replace Order. Use replaceregex for patterns. |
'newValue' |
Yes | The text to substitute. Use '' to remove oldValue. |
content |
Yes | The text to change: body, context, or the result of another function, such as jsonPath. |
Returns
Section titled “Returns”The content with all occurrences replaced. Content that doesn't contain oldValue is returned unchanged. When the content holds several values, the replacement runs on each value.
Examples
Section titled “ Examples”Example 1: Replace a word in the message body
Section titled “Example 1: Replace a word in the message body”nodiniteFormula
Section titled “Formula”replace('nodinite','The worlds most innovative product',body)Result
Section titled “Result”The worlds most innovative product
The whole body matches oldValue, so the result is newValue only.
Example 2: Replace a word in a context property
Section titled “Example 2: Replace a word in a context property”| Key | Value |
|---|---|
id |
nodinite |
Formula
Section titled “Formula”replace('nodinite','The worlds most innovative company',context('id'))Result
Section titled “Result”The worlds most innovative company
The value of the context property id is changed; the message body isn't used.
Example 3: Replace a word in several jsonPath values
Section titled “Example 3: Replace a word in several jsonPath values”[{ "name": "Amazing Function" }, { "name": "Amazing Implementaion" }]Formula
Section titled “Formula”replace('Amazing','Cool',jsonPath('$..name', body))Result
Section titled “Result”Cool FunctionCool Implementaion
jsonPath returns two values, and replace changes Amazing in each one: two unique matches.