Referencing data

Formulas are all about referencing and transforming data. Let’s see where that data can come from.

From upstream actions’ events 

Say we’re evaluating a formula's expression in Action B, which is downstream from Action A. Perhaps Action A had fetched a list of users from a remote API.

Now, Action B can make a reference to that data – for instance to count it:

COUNT(action_a.body.collections.users)

Simply refer to the snake cased name of the upstream action to access its data.

From resources 

Use the special RESOURCE key to access data residing in resources. Let’s say we have a text resource "Domain name". The following expression would fetch it:

RESOURCE.domain_name

From credentials 

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

CREDENTIAL.example_api_key

Metadata 

The META key exposes a useful set of information about the current environment. Here’s the full data structure it generates:

"tenant": {
  "domain": "example.tines.com",
  "name": "example"
},
"team": {
  "id": 123,
  "name": "Example team"
},
"story": {
  "id": 123,
  "name": "Example story",
  "key": "example_story",
  "is_test": false
},
"action": {
  "id": 123,
  "name": "Example action",
  "key": "example_action"
},
"story_run": {
  "id": "fc7b6392-b602-465b-8f58-ee07d33fa80e",
  "user_link": "https://example.tines.com/story_runs/fc7b6392-b602-465b-8f58-ee07d33fa80e"
}

So, for example, to access the name of the current story, you could use:

META.story.name
Was this helpful?