Tips and tricks for using in-line formulas in your Zaps

This article describes best practices when using in-line formulas in Zaps.

Combine static and dynamic values

If you need to use both static and dynamic values inside a formula, use the Text.concat formula to combine them first.

Example

If you want to combine a static value of “Hello” with a name value from a mapped field, you can use the Text.concat formula with one value being the static value and another being the dynamic value.

View of the Message Text field with the Text.concat formula containing the word Hell and a single mapped field as its values.

Nest formulas

When nesting one formula inside of another, build from the outside in: add the final formula first, then add the next formula inside of it.

Example

If you want to both concatenate and capitalize two values:

  1. Add the Text.uppercase formula.
  2. Replace its placeholder value with the Text.concat formula.
  3. Replace the values in the Text.concat formula.

View of the Message Text field with the Text.uppercase formula selected, with the Text.concat formula nested within it as its value. The Text.concat formulas contains the word Hello and a single mapped field as its values.

Swap formulas

To swap one formula for another:

  1. Click the field’s input box right after the formula.
  2. Press delete (Apple) or backspace (PC) on your keyboard to remove the formula. This will not delete the values inside the formula.
  3. Add a new formula.
  4. Copy the values that were in the previous formula.
  5. Paste the copied values inside of the new formula to replace the placeholder text.

Wrapping values in quotation marks

For certain data types, you must wrap values in quotation marks for the formula to interpret it correctly, especially when they contain special characters like spaces and commas. Other data types should not have values wrapped in quotation marks.

Data type Wrapping Example Notes
Text Wrap in quotation marks. "Hello world!"
  • You must use straight, double quotation marks ("text"), not angled double quotation marks (“text”).
Numbers Do not wrap in quotation marks. 123
  • Any indexing starts at 0.
Booleans Do not wrap in quotation marks. True
  • Use title casing (e.g. True, False).
Lists Wrap in quotation marks. "[1,2,3]”
  • You must use straight, double quotation marks ("text"), not angled double quotation marks (“text”).
  • Do not use comma-separated string. Instead, nest the Object.parse_json formula with the comma-separated string as its input (e.g. List.markdown_ordered_list(Object.parse_json('["a","b","c"]')).
Object Wrap in quotation marks. '{"first_name": "Jane","last_name": "Doe"}'
  • You must wrap the entire string, object, or array in straight single quotation marks ('json_str'), not straight or angled double quotation marks ("json_str" or “json_str”).
  • Use JSON-parsing to send an object (e.g. Object.parse_json('{"key": "value"}')).

Testing in-line formulas

When you test a step that contains an in-line formula, the Data in tab will display the entire formula, not the transformed data. You can review the output in the live test result in your app instead.

Additional resources

Learn more about available in-line formulas.

Was this article helpful?
0 out of 0 found this helpful