Illustrated in the below image is an example of a flow where the Record Generator is the source step.
In the image below, The Record Generator step is populated with data. The field names are “Description1”, “Description2” and “Description3”. In the values, the apostrophe ( ’ ), the letter “d” and the word “apples” are highlighted as the character, letter and word that you want to replace.
The image below contains the code that is used in the Calculator step. “Description1”, “Description2” and “Description3” are the name of the fields with the values that you want to change. Underlined in red are the character, letter and word that you want to replace. In this example, it is the apostrophe ( ’ ), the letter “d” and the word “apples”. Highlighted in yellow is what you want to replace the character, letter and word with. In this example, we are replacing the letter with the letter “b”, the character with an escape character and the word “strawberry”.
Below is the code to copy and paste in the Calculator step:
let inputRecord= input.record
inputRecord.Description1 = input.record.Description1.replace(/d/g,‘b’);
inputRecord.Description2 = input.record.Description2.replace(/’/gi,"\’");
inputRecord.Description3 = input.record.Description3.replace(/\apples/g,‘strawberry’);
Illustrated in the below image is the output of the values with the replacements.
- The backslash ( \ ) is an escape character for SOQL.