Skip to main content
All CollectionsKey features explained
Formulas and pills explained
Formulas and pills explained
Ruairí Galavan avatar
Written by Ruairí Galavan
Updated over 10 months ago

Many automation tools claim to be no-code. But once you need to do something tricky, like precisely assembling a piece of text, or modifying the structure of data between APIs, you’ll find yourself blocked, or needing to write code. That's where formulas come in. If you’ve used tools like Excel, you likely already know how to use them. And with our built-in library of hundreds of functions, and easy-to-use formula “pills”, you can easily tap into the power you need. Here's how they work.

Just like in spreadsheets, formulas in Tines allow you to transform data.

Where a formula in a spreadsheet references data from other cells, a formula in Tines references data from various other places in Tines. Formulas in Tines let you reference:

  1. Upstream event data

  2. Resources

  3. Credentials

Referencing upstream actions with formulas

Let's pretend we have an action that fetches the value from a form on page.

A downstream action could reference that data, for example, it could include the email address that the user submits. The formula would read something like:

user_form.body.your_email_address

Referencing resources with formulas

Resources in Tines are reusable pieces of data. Things like the same text, object, array, and file can be used used multiple times across multiple stories. To reference a resource in a formula, you can use the special RESOURCE key. Let’s say we have a text resource named "Domain name", the following expression would fetch it:

RESOURCE.domain_name

Referencing credentials with formulas

The CREDENTIALS key works identically to the previous RESOURCE example, for fetching credentials. Note: because these are inherently sensitive, we’ll never output a preview value in the formula builder when working with credentials. Use the following expression:

CREDENTIAL.example_api_key

Add formulas using “formula pills”

Formulas are most frequently used in actions. You can add one to the content of actions in Tines using a formula pill. Think of pills like dynamic variables in action text. Pills allow you to reference and format incoming event data using formulas. There are a few kinds of formula pills;

  • Value pills

  • Tag pills

When you use a pill, it displays the result of the formula expression when the action runs. For example, “The total amount is SUM(array)would read “The total amount is 300”.

Tags, on the other hand, control the flow of execution. Tags are particularly useful for doing things like building emails.

You can add a Value or Tag pill like this:

Editing formulas

Use the popup formula builder to author your formula expression. We’ll show in-line help and documentation as you type, and a preview of the result.

Adding formulas using “formula fields”

When you use a pill within a piece of text, the value is converted to text and joined with any surrounding text. This isn't always what you want, sometimes you will want to add a complex object directly to a payload.

To do this you can use a formula field, instead of a text field, inside the builder window. Using a formula field will return the value directly, rather than converting it to text. This is useful for cases where you want to return a dynamic non-text value, like an array or an object.

To start building with formulas now, you should check out these examples, and our library of functions.

Did this answer your question?