Skip to main content

Example on How to use #trigger references

Ossi Galkin avatar
Written by Ossi Galkin
Updated over a year ago

Common #trigger references

Each Trigger has its own set of variable values, which are defined when the Trigger is activated. Triggers also have common #trigger references:

  • #trigger.name

  • #trigger.type

  • #trigger.username

Later in the course, there will be an example Process demonstrating how to use these references.
​

Examples

Each Trigger has its own defined #trigger set. You can find more details for each Trigger's #trigger reference in other development courses about specific Triggers.

To give you an idea of the kind of Triggers there are, here are a couple of examples:

API Trigger

#trigger.data.body contains the payload data passed in the request body.

#trigger.data.header contains the request header parameters.

#trigger.data.query contains the query parameters.

#trigger.data.username contains the username associated with the caller. This is set only if authentication is used.

File Trigger

#trigger.data.files is of type array and contains the following properties

  1. FileChangeType

  2. FullPath

  3. FileName

HTTP Trigger

#trigger.data.queryParameters contains the passed HTTP query parameters.

#trigger.data.httpBody contains the HTTP request body as a string.

#trigger.data.username contains the username associated with the caller. This is set only if authentication is used.

Conditional Trigger

The results of the Subprocess used in the Conditional Trigger can be referred to with the reference #trigger.data.result.

Data #trigger refereces

The variables are referred to with the #trigger reference. The basic syntax is #trigger.data.parameter_name.
Example: #trigger.data.username

Some Triggers have parameters with properties that can be accessed with the syntax #trigger.data.parameter_name.property_name.
Example: #trigger.data.delivery_address.street_address

Example with #trigger references

Below is an example Process using common #trigger and data #trigger references.

If you have access to Frends environment we recommend you to create the example Process and test it by yourself.

The Process uses three different Triggers.

The Inclusive Decision Element branches the Process execution based on which Trigger activated the process.

For each Trigger type, the Process creates a message with Trigger-specific data and the created message is sent to a REST endpoint using the POST method.

The detailed configuration of each Element is presented below.

Manual Trigger

Note the Key triggerMessage in Manual Trigger configuration.


Schedule Trigger

Schedule Trigger is to set go off every two minutes.


HTTP Trigger

Note the URL parameter.


Inclusive Condition Branches

Each branch of the Inclusive Decision Element has own Expression for the branch.


Create Manual Trigger message

Note the #trigger references in the statement below. Three common #trigger references and one #trigger data reference are used. The data reference refers to the Key defined in the Manual Trigger.


Create Schedule Trigger message

Schedule trigger message Statement contains three common #trigger references.

Create HTTP Trigger message

HTTP Trigger message contains three common #trigger references and one data #trigger reference as an example.

Send message

The message is sent to test endpoint with the POST method.

Web RestRequest Task Frends GitHub page.

Example Process Execution Results

You can find three example executions of the Process below, each of which covers one of the Trigger types. Focus on the execution flow of the Process and the message content that was sent.

Manual Trigger

Schedule Trigger

HTTP Trigger

Did this answer your question?