> For the complete documentation index, see [llms.txt](https://docs.docontrol.io/docontrol-user-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.docontrol.io/docontrol-user-guide/workflows/define-workflow-settings/trigger-settings.md).

# Trigger settings

A trigger is usually a SaaS event, an alert, or an inventory action. When the defined event occurs, the workflow is set into motion. A trigger consists of:

* **Event** - A specific action in a SaaS application (such as file downloaded), or a DoControl inventory action.
* **Conditions** - A subset of the event, including an input value, a comparator, and an input value to check against.

{% hint style="success" %}
Workflow settings are now **simplified**. DoControl gives you a range of [predefined triggers](#to-define-the-trigger-settings) to choose from, that already include events and pre-populated conditions.&#x20;
{% endhint %}

## Who can initiate a trigger?

Both actors and admin users can initiate a trigger by their actions:

* **Actor** - A trigger can be initiated by a specific actor involved in the SaaS event. For example, an internal user triggers a workflow by sharing sensitive files with collaborators from non-trusted domains.
* **Admin user** - Alternatively, a trigger can be initiated by an admin user in the DoControl interface. For example, a CISO triggers a workflow by clicking the Remediate > Inventory action button to remove external collaborators.

#### How are inventory actions different from event-based workflows?

Inventory actions are triggered by a DoControl user according to demand, while event-based workflows are triggered every time a specific SaaS event occurs in a specific app.

<table><thead><tr><th width="239">Workflow type</th><th width="166">Trigger</th><th>Frequency</th></tr></thead><tbody><tr><td>Inventory action</td><td>DoControl user</td><td>On-demand</td></tr><tr><td>Event-based workflow</td><td>SaaS event</td><td>Whenever a specific event occurs</td></tr></tbody></table>

Trigger settings include these parameters:

* [Trigger events](#to-define-the-trigger-settings)
* [Conditions](#conditions)
* [Comparators](#comparators)
* [Date comparators](#date-comparators)
* [Condition values](#condition-values)
* [Condition logic](#condition-logic)

## Trigger events <a href="#to-define-the-trigger-settings" id="to-define-the-trigger-settings"></a>

An event is a specific action that occurs in a SaaS application, or a DoControl inventory action.

{% hint style="info" %}

* Workflow settings are now simplified. DoControl gives you a range of [predefined triggers](#to-define-the-trigger-settings) to choose from, that already include events and pre-populated conditions.&#x20;
* **For existing workflows**: If you change the **app** that triggers the workflow, then the canvas will be reset and all workflow steps will be deleted.
  {% endhint %}

#### To define a trigger event: <a href="#to-define-the-trigger-settings" id="to-define-the-trigger-settings"></a>

1. From the top-left ribbon, enter the workflow name (required) and description (optional).&#x20;
2. From the **App** drop-down list, select the SaaS app to trigger the workflow. <br>

   <div align="left"><figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2FMDHcCAMrPeWAENfkzNId%2Fselect%20app.png?alt=media&amp;token=b934b69a-27e8-412a-a556-5a6491be9aec" alt="" width="236"><figcaption></figcaption></figure></div>
3. Predefined triggers are displayed according to the app you selected: <br>

   <figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2Fxf8sHoIzEs0DUAjZXKxL%2Frec%20triggers.png?alt=media&amp;token=39a67595-4116-4101-a64c-4e2fc3530d96" alt=""><figcaption></figcaption></figure>
4. From the **Trigger** dropdown list, select an event to trigger the workflow:
   * **Predefined trigger** -  Includes a specific event already populated with predefined conditions.&#x20;
   * **Event** - Select either an event specific to the SaaS app, or a DoControl event (inventory action).<br>

     <div align="left"><figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2F4LK2XKO3OuECFLFIESYr%2Fpredefined%20trigger.png?alt=media&amp;token=09a6631c-8552-403e-8b32-ed560e616e9d" alt="" width="563"><figcaption></figcaption></figure></div>
5. If you select a predefined trigger, the event and some conditions are already populated:<br>

   <figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2FoR1BD8FdDJXh0krXhc3j%2Fsimplified%20conditions.png?alt=media&amp;token=5940c0b4-4e5e-4cbc-bf67-bfa52bce060f" alt=""><figcaption></figcaption></figure>
6. Add recommended conditions, or create a custom condition.

## Conditions

The conditions are based on data from the specific event you selected in the **Event** field. Each condition includes an input value, a comparator, and an input value to check against.&#x20;

You can define as many conditions as needed by clicking **+And** or **+Or** .&#x20;

You can enter an array of values (using a valid JSON array), and define a condition on **All** array elements or on **At least one**.

For more information, see [condition logic](#condition-logic).

<div align="left"><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2FfQzul9zdWVLabY4pMzsO%2Fimage.png?alt=media&amp;token=1e77724a-9be6-40eb-b026-22614e5f7374" alt="Event condition"></div>

<div align="left"><figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2FHiMZsxgC0yZvXh2tmMNa%2Fcondition%20types.png?alt=media&amp;token=4e4c132f-96da-4d12-a722-bcd5f9bc5e28" alt=""><figcaption></figcaption></figure></div>

#### To define custom event conditions: <a href="#to-define-the-trigger-settings" id="to-define-the-trigger-settings"></a>

1. From the first condition field, enter the [condition value](#condition-values).&#x20;
2. From the comparator dropdown list, select the [comparator](#comparators).
3. From the second condition field, enter the [condition value ](#condition-values)to check against.&#x20;
4. You can also select a group of conditions from a [predefined keyword list](/docontrol-user-guide/system-management/settings/lexical-lists.md).<br>

   <figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2FBxRQyNUi62rjF2VG4uwU%2Fcondition.png?alt=media&amp;token=3a7e4ef7-d8e9-4d82-85f5-85cffa5ee5e7" alt=""><figcaption></figcaption></figure>

#### To define a workflow condition based on a Google organizational unit:

You can define workflow conditions based on a specific Google organizational unit that the actor triggering the workflow belongs to.

1. In your workflow, add a custom condition.
2. Enter the `event.enriched.actorInfo.orgUnitPath` string.
3. Define the organizational path, for example:<br>

   <figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2F8Usv4USg9pjqGF336ewh%2Forgunit%20condition.png?alt=media&amp;token=6f4c2dd9-8ec4-4e4c-8b80-dbcf40e9403a" alt=""><figcaption></figcaption></figure>

## Comparators

You can use different comparator types to define your workflow conditions. Each condition automatically determines the relevant input type:

* **String** - compares between 2 condition values.
* **Boolean** - true or false condition.
* **Numeric** - uses mathematical operators to compare 2 condition values.
* **Date** - gives a specific date, or compares a date range. The granularity of the date picker includes hours, minutes and seconds. Dates are converted to Coordinated Universal Time (UTC) and compared without timezones.

{% hint style="info" %}
Only fields that are in ISO 8601 date string format are recognized.
{% endhint %}

{% tabs %}
{% tab title="String" %}

<table><thead><tr><th width="269">Comparator</th><th>Description</th></tr></thead><tbody><tr><td>Equals</td><td>The first condition value is the same as the second condition value.</td></tr><tr><td>Doesn't equal</td><td>The first condition value is not the same as the second condition value.</td></tr><tr><td>Contains</td><td>The first condition value includes the second condition value(s).</td></tr><tr><td>Doesn't contain</td><td>The first condition value does not include the second condition value(s).</td></tr><tr><td>Exists in</td><td>The first condition value can be found in an array of values of the second condition value(s).</td></tr><tr><td>Doesn't exist in</td><td>The first condition value cannot be found in an array of values of the second condition value(s).</td></tr><tr><td>In group(s)</td><td>The first condition value is included in the defined group(s) in the second condition value. See <a href="/docontrol-user-guide/saas-data-monitoring/inventory/settings-groups.md">groups</a>.</td></tr><tr><td>Not in group(s)</td><td>The first condition value is not included in the defined group(s) in the second condition value. See <a href="/docontrol-user-guide/saas-data-monitoring/inventory/settings-groups.md">groups</a>.</td></tr><tr><td>In trusted domains</td><td>The first condition value is included in a predefined set of trusted organization domains. See <a href="/docontrol-user-guide/saas-data-monitoring/inventory/inventory-domains.md#trusted-domains">trusted domains</a>.</td></tr><tr><td>Not in trusted domains</td><td>The first condition value is not included in a predefined set of trusted organization domains. See <a href="/docontrol-user-guide/saas-data-monitoring/inventory/inventory-domains.md#trusted-domains">trusted domains</a>.</td></tr><tr><td>In keyword list</td><td><p>The first condition value is taken from a list of predefined keywords specified in the second condition value: </p><ul><li><strong>Contains</strong> - Includes the specified value from the keyword list</li><li><strong>Exact match</strong> - Contains the exact value from the keyword list</li><li><strong>Starts with</strong> - Value in keyword list begins with this string</li><li><strong>Ends with</strong> - Value in keyword list ends with this string</li></ul><p>For more information, see <a href="/docontrol-user-guide/system-management/settings/lexical-lists.md">lexical lists</a>.</p></td></tr><tr><td>Not in keyword list</td><td><p>The first condition value is taken from a list of predefined keywords specified in the second condition value: </p><ul><li><strong>Contains</strong> - Everything that does not include the values in the keyword list.</li><li><strong>Exact match</strong> - Does not contain the exact value from the keyword list</li><li><strong>Starts with</strong> - Value in keyword list does not begin with this string</li><li><strong>Ends with</strong> - Value in keyword list does not end with this string</li></ul><p>For more information, see <a href="/docontrol-user-guide/system-management/settings/lexical-lists.md">lexical lists</a>.</p></td></tr></tbody></table>
{% endtab %}

{% tab title="Boolean" %}

<table><thead><tr><th width="269">Comparator</th><th>Description</th></tr></thead><tbody><tr><td>is</td><td>True or false</td></tr></tbody></table>
{% endtab %}

{% tab title="Numeric" %}

<table><thead><tr><th width="269">Comparator</th><th>Description</th></tr></thead><tbody><tr><td>=</td><td>Equals</td></tr><tr><td>!=</td><td>Does not equal</td></tr><tr><td>></td><td>Greater than</td></tr><tr><td>&#x3C;</td><td>Less than</td></tr><tr><td>>=</td><td>Greater than or equal to</td></tr><tr><td>&#x3C;=</td><td>Less than or equal to</td></tr></tbody></table>
{% endtab %}

{% tab title="Date" %}

<table><thead><tr><th width="269">Comparator</th><th>Description</th></tr></thead><tbody><tr><td>is on</td><td>Specific day and time (h, min, s) when event occurred.</td></tr><tr><td>is not on</td><td>Specific day and time (h, min, s) when event did not occur.</td></tr><tr><td>is on or before</td><td>The event occurred on the specified date and time (h, min, s) or before it.</td></tr><tr><td>is on or after</td><td>The event occurred on the specified date and time (h, min, s) or after it.</td></tr><tr><td>is between</td><td>The event occurred in the date range between the <code>from date</code> (inclusive) and the <code>to date</code>(exclusive).</td></tr><tr><td>is not between</td><td>The event did not occur in the date range between the <code>from date</code> (inclusive) and the <code>to date</code>(exclusive).</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

{% hint style="success" %}
Use square brackets \[ ] to include only a subset of dynamic values related to the comparator.
{% endhint %}

## Date comparators

You can use dynamic date comparators in workflow conditions to compare relative timeframes against runtime dates. This allows you to run a recurring cleanup workflow that evaluates relative dates, and remove sharing based on date conditions.

#### Example use cases:

* Was this file modified during the last 60 days?
* Is the sharing expiration date after the next 30 days?
* Is the file share date between 1 January 2023 and 1 May 2023?

#### To use dynamic date comparators:

1. Select the `Get event date` macro.
2. Select one of these comparators:
   * Before
   * After
   * In between<br>

     <div align="left"><figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2FVSuUCb7Qz46kMqsTTpgj%2Fdate%20comparator%20in%20between.png?alt=media&amp;token=311ed8f7-5e7b-4aec-811c-e9457ed79ecc" alt=""><figcaption></figcaption></figure></div>
3. Select a default time interval, or click **Custom** to define a custom timeframe.<br>

   <div align="left"><figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2Fw932NuSNUr29mUL41VIP%2Fdate%20past%20future.png?alt=media&amp;token=4a66aa08-0175-45f8-95c6-52aaeb0fbfde" alt=""><figcaption></figcaption></figure></div>
4. For a custom timeframe, select a relative or absolute timeframe:
   * **Relative** - Enter a past or future number of time units (minutes, hours, days, weeks, months)<br>

     <div align="left"><figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2F0thR5CN6OjCK7UcqzpgN%2Frelative%20time.png?alt=media&amp;token=dddea8c6-6b96-45d6-8e3b-530c6b2f025b" alt=""><figcaption></figcaption></figure></div>
   * **Absolute** - In the calendar picker, select a start date and time, and an end date and time.<br>

     <div align="left"><figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2FHvtcdpdwlc93j2JrzVwE%2Fabsolute%20time.png?alt=media&amp;token=a71aa106-91ff-4afe-b8b8-2c4723e78b37" alt=""><figcaption></figcaption></figure></div>
5. Click **Save**.

## Condition values

There are a number of ways to input values in the condition fields:

* **Select from event** (default) - Select an event field from the dropdown list. &#x20;
* **Use macros -** Select a [macro](/docontrol-user-guide/workflows/define-workflow-settings/trigger-settings.md#macros) from the condition builder. Relevant macros are displayed according to the SaaS application, and the selected event.
* **Use query -** Enter the query expression using the **Query event fields** window, containing details from the event in JSONata. The event values in the query are sample values coming from the last event registered in the system.

### Macros

You can use query macros from the condition builder to create your workflow. The condition builder displays macro conditions by name instead of the JSONata expression.

For example, you can get the names of a file's collaborators by selecting the macro called: Get collaborators.

This makes it easier to understand what the condition is trying to achieve. You can also access macros from the Query event fields (JSONata view).&#x20;

{% hint style="info" %}
Macros appear according to the SaaS app and the selected triggering event.
{% endhint %}

<figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2FO6iAHk6IwlzXcNm5z41m%2Fmacros.gif?alt=media&amp;token=28960341-9bcd-4631-b593-959acbbe1d17" alt=""><figcaption><p>Using query macros from the condition builder to create a workflow</p></figcaption></figure>

<figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2FtkzQ8GAgmBTHepPtj5Ag%2Fquery%20event.png?alt=media&amp;token=3c2de524-0244-4265-b498-960fde0f92ed" alt=""><figcaption><p>Using macros from the Query event window</p></figcaption></figure>

## Condition logic

The workflow condition builder for both trigger and conditional actions constructs a set of sub-conditions using Boolean arithmetic logic.&#x20;

Boolean operators include **AND** and **OR** and the construction paradigm is as follows:

* Sub-conditions are X, Y, Z:

```
(X AND Y) OR (Z) OR (K AND L AND M)
```

* **AND** operator constructs sub-condition groups
* **OR** operator is used between groups

These examples illustrate a variety of conditions constructed with the workflow condition builder:

#### (A) OR (B)

<div align="left"><figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2Fn1yEhcv0fborcMlH6Q7I%2Fand-or%20condition%20logic.png?alt=media&amp;token=40a58922-a270-48b8-93a1-187cd8a660cc" alt=""><figcaption></figcaption></figure></div>

#### (A AND B) OR (C)

<div align="left"><figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2FNbpZO4FhR0xbY8a2CzfZ%2Fa%20and%20b%20condition%20logic.png?alt=media&amp;token=edb3d4dd-df4f-40ee-b870-a6edc94c4584" alt=""><figcaption></figcaption></figure></div>

#### (A) OR (B AND C AND D)

<div align="left"><figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2FZawaV9GayM5nwouBLSCu%2Fa%20or%20b%20and%20c%20condition.png?alt=media&amp;token=909608ea-47ce-4396-9398-dd9eb2706f63" alt=""><figcaption></figcaption></figure></div>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.docontrol.io/docontrol-user-guide/workflows/define-workflow-settings/trigger-settings.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
