---
title: "Trigger Automations"
url: "https://books.automatevalue.com/2/spotler-connector/23/trigger-automations"
---

# Trigger Automations

Spotler has the [Automations module](https://helpcenter.spotler.nl/hc/en-us/articles/4403836193938-Introduction-Automations) and the older [Campaign module](https://helpcenter.spotler.nl/hc/en-us/articles/360034938254-Introduction-getting-started-with-campaigns). With these modules it is possible to send 1-on-1 mails based on certain changes, fully automated. In this way you can create full customer journeys.

With SpotlerAutomate you can also trigger these Automations (and [Campaigns](../30/trigger-campaigns)) from within Dynamics 365. Consider, for example, a welcome process for new customers, an e-mail with a brochure or an automatic _'customer lifecycle campaign'_ that is relevant to the recipient.

* [New Automation](#new-automation)
* [Start Automation](#start-automation)
* [Stop Automation](#stop-automation)

---

## New Automation

An **Automation** needs to be [created in Spotler](https://mailplus.spotler.help/hc/en-us/articles/5438755158546-New-Automation).

Add an **External Trigger** and give it a good label (this label will be visible in Dynamics 365). When you create this **External Trigger** it will automatically generate a Code.

![automation-external-trigger.png](/u/automation-external-trigger-0dz8ri.png)

>❗Don't forget to change the status of the Automation to _Final_ and [publish it](https://helpcenter.spotler.nl/hc/en-us/articles/4407729601042-Publisher).

Twice a day, published Automations will be synchronized to Dynamics 365.

>💡Tip: You can also refresh this yourself by creating a _[Spotler Job](../25/spotler-jobs)_ with the operation **Refresh Automations**.

---

## Start Automation

To start an Automation from Dynamics 365, we create a _[Spotler Job](../25/spotler-jobs)_ with the operation **Start Automation**.

Select the Customer (=Account/Contact) or a Lead for which you want to start the Automation.

Select the desired Automation you want to trigger. Keep in mind that the list contains both Automations (🚀) and [Campaigns](../30/trigger-campaigns) (📢)!

Now press **Save** to create the _Spotler Job_. This will trigger the Automation to start.

![automation-form-fill.png](/u/automation-form-fill-YuvLdn.png) 

In Spotler, under _Automation > Publisher_, you can see then number of the times the published Automation is triggered. From here it is also possible to see the [Report](https://helpcenter.spotler.nl/hc/en-us/articles/5498046682514-Report-Automation).

![automation-number-triggered.png](/u/automation-number-triggered-J3GCGu.png)

When the Automation has been triggered, the _Spotler Job_ will be updated with the result. When successful the _Result Code_ will be `OK` and _AutomationContactId_ will have a value. This value represents the specific run that is started, which optionally can be used to stop the Automation. 

![automation-result-success.png](/u/automation-result-success-0VgysY.png)

Successful started Automations are also shown as post in the Timeline of the Contact, Lead or Account.

![timeline-automation.png](/u/timeline-automation-A8l9Gl.png)

### Automation Fields

It is possible to personalize messages that are sent by Automations with data from Dynamics 365. This data can be added when we trigger an automation, and therefore doesn't need to be known to Spotler beforehand.

To define which data can be added to a trigger, we add [Automation Fields to message(s)](https://helpcenter.spotler.nl/hc/en-us/articles/360012079993-Trigger-automations#h_01G7AM77R22TZSSNGRWCK6HPMB)_, like `[automationfield:invoiceEmail]`. When we do this, the automation field `invoiceEmail` will become available to add to the trigger.

When we create a **Spotler Job** in Dynamics 365 and select the operation **Start Automation**, the **Automation Fields** will be prepopulated with all the possible fields and the expected type of the value (`STRING`, `URL` or `PRODUCTLIST`).

![automation-fields.png](/u/automation-fields-hLrJ1m.png)

We need to replace the type hint with the actual data we want to pass to the Automation. Make sure each _Automation Field_ is separated with a semicolon (;) or a Enter (⏎). If you don't want to pass a value for a specific _Automation Field_, leave the field blank or remove it completely. The following examples are all valid:

```text
invoiceEmail=invoice@company.com;invoiceCode=;invoiceVatNumber=NL123456
```

```text
invoiceEmail=invoice@company.com;invoiceVatNumber=NL123456
```

```text
invoiceEmail=invoice@company.com
invoiceCode=
invoiceVatNumber=NL123456
```

```text
invoiceEmail=invoice@company.com
invoiceVatNumber=NL123456
```

When the type hint is a `PRODUCTLIST`, we can add more than one value to the Automation Field. They need to be placed in curly brackets, separated by commas (like `{<STRING>,<STRING>,<STRING>,etc}`).

So:

```text
crosssell={<PRODUCTLIST>}
```

Becomes:

```text
crosssell={123,567,891}
```

---

## Stop Automation

Sometimes we want to stop an already long running Automation. For example, when a _'New Customer Journey'_-Automation is started, but the customer canceled the purchase.

We can stop an Automation in the same way we started an Automation, by creating a _[Spotler Job](../25/spotler-jobs)_.

Create a _Spotler Job_ with the operation **Stop Automation**.

We select the Customer or Lead and the Automation we want to stop. Press **Save** to create the _Spotler Job_. This will trigger the Automation to stop.

![automation-stop-form-fill.png](/u/automation-stop-form-fill-Xrm0do.png)

This will stop all the running automation's for this specific Automation and Contact.

### Stop a specific run

If you only want to stop a specific run, you can use the _AutomationContactId_. The _AutomationContactId_ is stored in the _Spotler Job_ that triggered the Automation to start. No other parameters are needed, except for the _AutomationContactId_.

You can specify multiple _AutomationContactId_'s by separating them with a comma.

![automation-stop-form-fill-contactid.png](/u/automation-stop-form-fill-contactid-GdGY3o.png)
