# Setting up Automation integration

> To trigger automations, you must set up Automation integration.The following sections describe the steps to set up an Automation integration for a **Process Mining** process app.

## Introduction

To trigger automations, you must set up Automation integration.The following sections describe the steps to set up an Automation integration for a **Process Mining** process app.

### Manually triggered and automatically triggered automations

There are two different types of automations that can be triggered from a process app.

1. Manually triggered automations are initiated by business users from the process app dashboards.
2. Automatically triggered automations are initiated when predefined conditions, determined by tags, are met during the data run for the process app.
   :::note
   Manual triggers can be done from both the development and published app. Automatic triggers are only applied when loading data on a published app.
   :::

### Send email example

You can download the [Send_Email_example_files.zip](https://documentationpicturerepo.blob.core.windows.net/files/Process_Mining/Orchestrator_integration/Send_Email_example_files.zip) file to easily set up an automation integration for sending an email yourself.

The **Send_Email_example_files.zip** file contains:

* A **SendEmail.zip** file with an automation workflow project that you can import in **Studio**.
  :::note
  The automation workflow is built in UitPath Studio 2022.10.5.
  :::
* A simpleschema.json file that you can use to set up the **Orchestrator** queue.

## Step 1: Create an automation workflow

:::tip
You can start building an automation in **Studio** directly from **Automation manager**.
1. In **Process Mining** open the process app for which you want to enable automation integration in the **Dashboard editor**. Refer to [Working with the dashboard editor](https://docs.uipath.com/process-mining/automation-cloud/latest/user-guide/working-with-the-dashboard-editor#working-with-the-dashboard-editor) for details.
2. In the **Dashboard editor**, select the **Automation manager** option to open the **Automation manager**.
3. Select **Build automation** to open Studio. Refer to [Automation manager](https://docs.uipath.com/process-mining/automation-cloud/latest/user-guide/automation-manager#automation-manager "Automation manager enables you to manage automations connected to Process Mining. With Automation manager you can select Orchestrator queues to be used for automations triggered by business users from the process app.Select the menu in the header bar of the dashboard editor and select Automations from the drop-down menu. The Automation manager page is displayed, showing the automations defined for your process app.") for details.
:::

To set up **Automation integration**, first create an automation workflow in **Studio**. For example, you can set up an automation for sending an email when an item is added to an Orchestrator queue. This automation can be used, for example, to send a reminder email for a late payment case detected in **Process Mining**. The following illustration shows an example automation workflow.

Define a **Get Transaction Item** activity in the automation workflow if you want to enable pulling items from queues.

![Get Transaction Item activity](https://dev-assets.cms.uipath.com/assets/images/process-mining/process-mining-get-transaction-item-activity-130165-1931baf5-1d2f7b61.webp)

In the above example: ***Set Variable Value*** activities are used to set the arguments to variables that can be used in the email. The **Microsoft Office 365: Send Email** activity is used to send a notification email from the automation.

1. In **Studio**, publish the automation to make it available in **Orchestrator.**

## Step 2: Set up an Orchestrator queue

1. In **Orchestrator**, create a new queue using a **Specific Data JSON Schema**. The Data JSON Schema defines the input data that is required for the automation. Make sure the JSON schema matches the arguments defined in the automation.
   :::important
   Only queues containing a **Specific Data JSON Schema** file in Orchestrator are supported by **Process Mining**. The following code shows an example of a **Specific Data JSON Schema** that is used to set up integration with **Process Mining**.
   :::

```
{  "definitions": {},
   "$schema": "http://json-schema.org/draft-07/schema#",
   "$id": "http://example.com/root.json",
   "type": "object",
   "title": "The Root Schema",
   "properties":{
           "CaseID":
            {  "type": ["string", "null"]
        },
            "Supplier":
            {  "type": ["string", "null"]
        },
            "Value":
            {  "type": ["string", "null"]
        },
            "Email":
            {  "type": ["string", "null"]
        }
   }
 }
```

:::note
For columns that should not contain `null` values, remove `,"null"` from the property definition.
:::

2. Add a **Trigger** for the queue and select the automation workflow you created in **Studio** as the process associated.

   

   

When you have created a queue in **Orchestrator**, you can reference that queue from a **Process Mining** process app.

## Step 3. Configure the automation integration in Process Mining

1. In **Process Mining** open the process app for which you want to enable automation integration in the **Dashboard editor**. Check out [Working with the dashboard editor](https://docs.uipath.com/process-mining/automation-cloud/latest/user-guide/working-with-the-dashboard-editor#working-with-the-dashboard-editor).
2. In the **Dashboard editor**, select the **Automation manager** button to open the **Automation manager**. Check out [Automation manager](https://docs.uipath.com/process-mining/automation-cloud/latest/user-guide/automation-manager#automation-manager "Automation manager enables you to manage automations connected to Process Mining. With Automation manager you can select Orchestrator queues to be used for automations triggered by business users from the process app.Select the menu in the header bar of the dashboard editor and select Automations from the drop-down menu. The Automation manager page is displayed, showing the automations defined for your process app.").
3. Add a new automation and select the **Orchestrator** queue.
   * Select **+Connect automation**.
     :::note
     If you have not created an automation, you can select the **Build automation** option to open **Studio**, where you can start building an automation.
     :::
   * In the **Add queue** dialog select the **Orchestrator** queue you want to use. The data schema defined in the Data JSON Schema file for the **Orchestrator** queue is loaded. Note that only queues containing a **Specific Data JSON Schema** file in **Orchestrator** are available for **Process Mining**.
   * If applicable, select the **Object** for which you want to configure the automation.
   * Map the automation input fields to the appropriate data fields available in your process app.
     :::important
     Check out the data type of the queue input fields defined in the **Specific data JSON schema** and make sure to map the input fields to a **Process Mining** data field with the correct input type. Check out [App Templates](https://docs.uipath.com/process-mining/automation-cloud/latest/user-guide/app-templates#app-templates).
     :::

     Instead of mapping to a specific **Case field**, you can select the **Business user input** option for a text input field. This enables business users to enter a free text when triggering an automation — for example, a description or an email address. The **Analyst input** option enables you to enter a custom text which is displayed as read-only to the business user. ![Field mapping options](https://dev-assets.cms.uipath.com/assets/images/process-mining/process-mining-field-mapping-options-464981-21e961a3-9551ae0a.webp) The **Business user input** option is only applicable to **Manual** triggers.
   * Enter the **Maximum number of objects sent at once** to limit the number of objects that can be sent to **Orchestrator**.
     :::note
     As an analyst, it is important to consider limiting the number of objects a business user can send to Orchestrator based on the specific use case. By default, the system allows 50 objects to be sent to the queue, but the range can be adjusted from 1 to 1000, providing flexibility for different scenarios.
     :::
   * Select the type of the trigger for the automation from the **Trigger** list box. If you want to configure an **Automatic** trigger for an automation, add the tags to define the trigger conditions. An object that meets a condition when the filter is evaluated will be sent to Orchestrator.
     :::note
     Each trigger condition is evaluated separately. For example, Case 001 has tags A and B. When you have set the trigger conditions for both A and B, this case will be sent to Orchestrator twice (one based on condition A and one based on condition B).
     :::
4. Publish the process app to make the automation available in the published process app.
   * Select **Publish**.The automation is now available in the process app.

### Manually triggered automations

When you select the **Manual** trigger type for the automation, business users can trigger the automation from the published process app. The **Trigger an automation** option is available on most dashboards and charts. The following illustration shows an example.

When the user has selected objects that are candidate for automation, the **Trigger an automation** option can be selected to enter the input data for the automation.The following illustration shows an example.

![Trigger an automation panel](https://dev-assets.cms.uipath.com/assets/images/process-mining/process-mining-trigger-an-automation-panel-130119-e1bc9bef-61730cd3.webp)

For every case that is selected, a Queue item is created in the Orchestrator queue that will trigger the automation defined in **Studio**.

Refer to [Triggering an automation from a process app](https://docs.uipath.com/process-mining/automation-cloud/latest/user-guide/triggering-an-automation-from-a-process-app#triggering-an-automation-from-a-process-app) for details on how to trigger an automation from a published process app.

### Automatically triggered automations

Automated triggers can trigger automations when specific events occur within the process. This allows for immediate attention to a case for enhanced efficiency and streamlined workflows.

When you select the **Automatic** trigger type for the automation, the automation is triggered automatically when the trigger conditions have met. The trigger conditions are determined by tags that are evaluated any time data for the process app is loaded. Each case that meets the conditions creates a Queue item in the Orchestrator queue, which initiates the automation defined in Studio.

## Step 4. Execute the automation

A robot will pick up the automation and perform the action defined in the automation.
