Triggers

Learn how to use triggers to enhance your automations!

What is a Trigger?

  • A trigger is something that lives on a script, and automatically runs that script at a particular event.

  • These triggering events can be

    • Event based: This means they have been caused by edits or changes to particular entities

    • Time based: eg. every 5 minutes

How to set up a Trigger

Navigate to the script that you want to be triggered. In the right hand side bar, you will see a 'Triggers' tab. From there, you can view and remove existing triggers, as well as creating new ones.

You can view (but not edit) all existing triggers from the organisation settings page. For each trigger here you can see:

  • what event will trigger it

  • what script it applies to

  • all runs of the trigger, their status, timings and logs

In the audit log, the 'user' who runs the script and is responsible for any of the scripts actions will be the 'trigger runner'.

Different Trigger Events

Entity dependent:

These events all relate to changes to certain entities, you can pick which entities classify when you make the event.

  1. Choose whether you want the trigger to apply to changes to Templates, Instances, or both

  2. Choose specific entities that you want to trigger on.

If you choose 'INSTANCE' , but you then select a specific template entity, this means the trigger will apply to all instances of that template.

If you choose 'INSTANCE' and select an instance, that trigger will only look for trigger events on that singular entity, likewise if you choose 'TEMPLATE' and select a template.

Entity dependent event
Description
Notes

onMoveOutOfEditable

This will trigger the script to run whenever a chosen entity becomes non-editable

The only way for entities to become 'non-editable' are to be sent for review or published

onCreate

This will trigger the script to run when a chosen entity is created

This trigger will only work when INSTANCE has been chosen, and a specific template selected.

onArchive

This will trigger the script to run when a chosen entity is archived

-

onRecover

This will trigger the script to run when a chosen entity is recovered

-

onMakeEditable

This will trigger the script to run whenever a chosen entity moves from non-editable to editable

This can happen when new drafts are made, when review requests are disapproved or cancelled, or if validation checks fail.

As these triggers are all entity dependent, meaning the script can run with the context of the entity that triggered it.

Eg. If the script is to add a tag to the entity, and the trigger is onCreate - every time an entity is created that matches the conditions, the script can tag that particular entity

Entity independent:

Entity independent triggers allow scripts to run autonomously, without being directly tied to a parent entity. These scripts can still interact with and perform actions on various entities, but they operate independently from any specific entity.

Name
Description
Notes

onSchedule

This will execute the script at predetermined intervals, such as every 5 minutes or at midnight daily.

Scheduled times are evaluated in the UTC timezone, ensuring consistent execution regardless of local time variations.

Entity independent scripts are particularly useful for tasks that require regular execution or maintenance, such as cleanup processes or periodic data analysis, without the need for entity-specific context.

Last updated