# Flow Trigger

<figure><img src="https://291121471-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McrRFZHYH27bqKzOVDd%2Fuploads%2FpVESimtGN3GAVsvGSbI0%2Fimage.png?alt=media&#x26;token=73569b02-902d-4b6a-b3cb-ee36c4b2f50d" alt="" width="157"><figcaption></figcaption></figure>

## Actions

Flow Trigger has only one default action - Trigger flow.\
Optionally, you can select to execute the triggered flows [**synchronously**](#2.-synchronous) or [**asynchronously**](#2.-asynchronous)**.**

### **Setup**

1. Include the ID of the flow you want to execute.
2. Select execution mode. The default is `asynchronously`

<figure><img src="https://291121471-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McrRFZHYH27bqKzOVDd%2Fuploads%2FCRgB1Y0HzvfyiefBKMIU%2FMonosnap%20Flow%20Builder%20%40%20Locoia%202024-08-28%2017-48-15.png?alt=media&#x26;token=fb505677-7261-449b-8082-78c0acb5026e" alt="" width="563"><figcaption></figcaption></figure>

If you include Flow Trigger in a Loop to call many other flow runs (e.g. more than 100), it is best practice to include a small delay, using the [Delay Helper](https://docs.locoia.com/connectors/helpers/delay-helper), in order to limit the load on the new flow and any systems it may call.

If you need to trigger multiple flows, you can place this additional trigger:

1. **Right Behind the First Trigger:** This way, multiple flows will be triggered sequentially, one after another.
2. **At the End of the Triggered Flow:** If you want the second flow to run after the first one completes its execution, you can place the Flow Trigger at the end of the first triggered flow. This ensures that the flows execute in a specific order.

## S**ynchronous and asynchronous execution:**

{% hint style="info" %}
In **both** execution modes, it is possible to access variables previously defined in the initial (trigger) flow in the subsequently triggered flows.
{% endhint %}

This means, that if there is `zendesk_contacts` defined in the initial **(trigger)** flow, you can just reference `{{ zendesk_contacts[1] }}` in the **triggered** flow to get the first contact of Zendesk from the initial flow.

### **1. Asynchronous**

It immediately triggers the flow and continues with the next subsequent step in the initial flow.\
If it is set to **asynchronously**, the flow with the Flow Trigger cannot access the variables of the other flow (as it might not have run yet). Therefore you can't access variables defined in the **triggered** flows back in the initial **(trigger)** flow.&#x20;

### **2. Synchronous**

This mode waits for the underlying flows to be finished executing.  \
If it is set to **synchronously**, you can access variables defined in the **triggered** flows back in the initial **(trigger)** flow.&#x20;

{% hint style="info" %}
In case of variables with the same names, the most recent instance will be referenced.&#x20;
{% endhint %}
