Remember values between runs

Stored values let a workflow pick up where it left off, keep a count, or share a value with other workflows, from one run to the next.

Each run starts fresh: a step's result lasts only until the run ends. To keep something for the next run, such as the last record a workflow processed, save it as a stored value.

The four steps

StepWhat it does
Set a stored valueSaves a Value under a Name, replacing what was there
Get a stored valueReads it back, or returns the Default value when nothing is stored yet
Increment a stored valueAdds an Amount (1 unless you change it) to a counter and returns the new total
Delete a stored valueRemoves it; deleting something that was never set does nothing

Each value has a Scope: the whole workspace, shared by every workflow, or just this workflow.

Pick up where it left off

A scheduled workflow that handles new records can remember how far it got:

  1. Run on schedule

    Built-in step · every hour

    Trigger
  2. Get a stored value

    Built-in step · last_seen

  3. List orders

    Shopify · created after @cursor.value

  4. Repeat for each item

    Built-in step

  5. Create a QuickBooks invoice

    QuickBooks

  6. End repeat

    Built-in step

  7. Set a stored value

    Built-in step · last_seen

Read where the last run stopped, handle what's new, and save the new position.

Get a stored value returns found, which is false the first time, and value. Give it a Default value so the first run knows where to start.

Count things safely

Increment a stored value is safe to run from many runs at once: every increment is counted, with none lost. The counter starts at zero the first time. Its value must be a number; if it holds something else, the step fails and nothing is added.

Names and fields

Names use letters, digits and underscores, and each part can't start with a digit, such as last_seen or invoice_count. To work with one field inside a stored object, add a dotted path: customer.email. Setting a dotted path fills in any missing objects along the way.

Letting workflows change a value

A workflow can always read a stored value. To set, increment or delete one that someone created in the workspace, that value needs Let workflows edit this value turned on. A value a workflow creates itself can always be edited by workflows.

Reference

Every field of these steps is on the Stored Data Values reference page.

On this page