Trigger

The trigger initiates a function to execute its action. To do this, the trigger listens for events. Events can be captured by users or programmatically.

Jump to explainer video.

Trigger events

The following events can serve as triggers:

  • Backend events

    • change, update, or becoming true of an input argument

    • change, update, or becoming true of an output

    • change, update, or becoming true of a modifier

  • Frontend events

    • Click of a button

    • Loading of a page

    • Start of an app

      • once

      • periodic (every 0.1 seconds to once a day)

    • Stop of an app

  • App Builder: Click on the trigger icon of the function

A single function can be associated with more than one trigger event. For instance, a function might be triggered when its input argument is updated or when a page is loaded.

Configuration

A trigger can be configured in different ways:

  • Via context menu: Right-click on the trigger box

    • App start

    • App stop

  • Drag and drop of other items on a trigger

    • on page load

    • on input change, update, true

    • on output change, update, true

    • on modifier change, update, true

  • Drag and drop of a trigger on a button

To unlink an event from a trigger, click the x next to the trigger event.

Sequential processing

To sequentially process an array of data, the trigger can be configured to execute the function for each value within the array individually, one by one. This type of function execution corresponds to a so-called loop in classic programming.

To configure sequential processing of arrays:

  1. Right-click on the trigger to open the context menu.

  2. Hover above Process One By One.

  3. Select the input argument of the function that contains the array.

To switch back to regular processing:

  1. Right-click on the trigger to open the context menu.

  2. Select Process Regularly.

Example: One prevalent use case for sequential processing is merging objects, where an array of objects contains objects to merge with another object. The following image illustrates a function where the trigger of the mergeObjects function is configured to Process One By One on argument one (On arg 1). As a result, both objects in the output contain the keys of both merged objects.

Explainer video

Last updated