# Quickstart

> In this section, learn how to use the **UiPath Add-in for Salesforce** in a simple Salesforce business process automation.

In this section, learn how to use the **UiPath Add-in for Salesforce** in a simple Salesforce business process automation.

## Introduction

The purpose of this guide is to show you how to use the **UiPath Add-in for Salesforce** in a simple Salesforce business process automation (via Process Builder). Using a Salesforce Opportunity object as an example, you'll complete the following:

1. [Add a connection](https://docs.uipath.com/add-ins/other/latest/user-guide/salesforce-quickstart#add-a-connection)
2. [Create a Queue Template](https://docs.uipath.com/add-ins/other/latest/user-guide/salesforce-quickstart#create-a-queue-template)
3. [Create a Job Template](https://docs.uipath.com/add-ins/other/latest/user-guide/salesforce-quickstart#create-a-job-template)
4. [Build an Automation Process](https://docs.uipath.com/add-ins/other/latest/user-guide/salesforce-quickstart#build-an-automation-process) (Process Builder)
5. [Test your Automation Process](https://docs.uipath.com/add-ins/other/latest/user-guide/test-yout-automation-process#test-yout-automation-process)

After completing the steps in this guide, you'll have an add-in that does the following:

1. Establishes an authenticated connection between your Salesforce platform and a UiPath Orchestrator Tenant. This guide uses an on-premise UiPath Orchestrator connection.
2. Adds a Queue item to an existing Queue when a Salesforce Opportunity object stage changes to **Closed Won**.
3. Creates a new Job to execute an existing Process when a Salesforce Opportunity object stage changes to **Closed Won**.
   :::note
   For more information about the UiPath Add-in for Salesforce and its features, see the following pages:
   * [About](https://docs.uipath.com/add-ins/other/latest/user-guide/salesforce-about#about)
   * [Setup](https://docs.uipath.com/add-ins/other/latest/user-guide/salesforce-setup#setup)
   * [Connection Settings](https://docs.uipath.com/add-ins/other/latest/user-guide/salesforce-connection-settings#connection-settings)
   * [Templates](https://docs.uipath.com/add-ins/other/latest/user-guide/salesforce-templates#templates)
   * [Orchestrator notifications](https://docs.uipath.com/add-ins/other/latest/user-guide/salesforce-orchestrator-notifications#orchestrator-notifications)
   :::

## Prerequisites

Before you begin:

1. Complete the [Setup](https://docs.uipath.com/add-ins/other/latest/user-guide/salesforce-setup#setup) steps.
2. Set up a new, or use an existing, UiPath Orchestrator instance that has a Tenant, Environment, Process, and Robot.
   :::note
   For the purposes of this guide, ensure that you have an available Robot that does not have existing jobs in the pending state; this makes it easier to verify the success of your setup and process.
   :::

## Steps

1. [Add a connection](https://docs.uipath.com/add-ins/other/latest/user-guide/salesforce-quickstart#add-a-connection).
2. [Create a Queue template](https://docs.uipath.com/add-ins/other/latest/user-guide/salesforce-quickstart#create-a-queue-template).
3. [Create a Job template](https://docs.uipath.com/add-ins/other/latest/user-guide/salesforce-quickstart#create-a-job-template).
4. [Build an automation process](https://docs.uipath.com/add-ins/other/latest/user-guide/salesforce-quickstart#build-an-automation-process).
5. [Test your automation process](https://docs.uipath.com/add-ins/other/latest/user-guide/test-yout-automation-process#test-yout-automation-process).

### Add a connection

1. Go to the **UiPath Setup** page. You can use the **App Launcher** to search for **UiPath Setup**.
2. In the left-hand panel, click **+ Add a Connection** (this opens the **Connection Settings** form).
3. Complete the **Connection Settings** form:
   * Enter a unique **Connection Name**. This name is only used in the UiPath Add-in for Salesforce application and it does not need to match the name of the tenant you're connecting. Your name can include alphanumeric characters (a-z, 0-9), special characters, and spaces. This name is not editable after you save the form via the **Connect** button.
   * Enter the **UiPath Orchestrator URL** that you're connecting to (for example, `https://myorchestrator.com`).
   * Enter the **Tenant Name** that you're connecting to. This name must match the name of the UiPath Orchestrator tenant.
   * Enter the **Email** or **Username** that you want to use for your connection, and the **Password** associated with the corresponding email or username if you choose **User Credentials** as a connection type. As an alternative, you can choose **Named Credential** (see more details in [How to set up a Named Credentials connection](https://docs.uipath.com/add-ins/other/latest/user-guide/salesforce-set-up-named-credentials)).
     * The user must have permissions to access the tenant. For more information, see [About Users](https://orchestrator.uipath.com/docs/about-users) in the Orchestrator Guide.
4. Click the **Connect** button.
   * The system verifies the authentication information by establishing a connection.
   * If the connection is unsuccessful, a red notification stating "Unable to authenticate UiPath credentials. Please verify and try again." appears at the top of the screen. To resolve the issue, verify your form entries and click the **Connect** button again.

     ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44797-fb11ab52-e3d398f2.webp)

### Create a Queue template

1. In the left-hand panel, select the connection you created and click **Templates**.
2. In your **Templates** page, click the **New** button (this opens the **Create New Template** wizard).

   ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44849-d817e03e-7efaef2e.webp)
3. Complete the first page of the template form:
   * Enter a **Template Name** (required). Your name must start with a letter and may only include alphanumeric characters (a-z, 0-9) and underscores. This field does not accept spaces or special characters.
   * Enter a **Template Description** (optional).
   * Select the **Queue** radio button.
4. Click the **Next** button.

   ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44521-388668c3-06dfcbe4.webp)

   :::note
   The **Connection** field defaults to the connection that you select to create the template. You can't change the default connection during template creation, but you can after the template is created.
   :::
5. Complete the second page of the template form:
   * Select a **Queue Name** from the list of available Queues. If you don't see the Queue that you want to use, go to your UiPath Orchestrator and verify the Queues are present in your tenant.
   * Select a **Priority** (for example, **High**). This sets the processing importance for the Queue item.
   * Click the **Next** button.

     ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44705-429d61df-a48f00e7.webp)
6. Complete the final page of the template form:
   * Select a **Salesforce Object** (for example, **Opportunity**).
   * Select the **Opportunity Fields** that you want to use for your Queue item (for example, **Opportunity ID**, **Account ID**).
7. Click the **Save** button.

   ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44464-4ddd3708-c614cac0.webp)
8. Verify the new Queue Template appears in your list of templates.

   ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44580-e3c01adb-16968cd6.webp)

You're done! Now, let's create a complementary Job Template.

### Create a Job template

1. In your Templates page, click the **New** button (this opens the **Create New Template** wizard).
2. Complete the first page of the template form:
   * Enter a **Template Name** (required). Your name must start with a letter and may only include alphanumeric characters (a-z, 0-9) and underscores. This field does not accept spaces or special characters.
   * Enter a **Template Description** (optional).
   * Select the **Job** radio button.
3. Click the **Next** button.

   ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44701-c451dcfc-28d6f4fd.webp)
4. Complete the second page of the template form:
   * Enter the **Environment** that you want to use to deploy your process (the available Environments are returned when you start typing). If you don't see the Environment name in the list, go to your UiPath Orchestrator and verify it's present in your tenant. For more information, see [About Environments](https://orchestrator.uipath.com/docs/about-environments) in the Orchestrator Guide.
   * Enter the **Process** that you want to run (the available Processes are returned when you start typing). The name must match the name of the Process in your tenant. If you can't find the process you're looking for, go to your UiPath Orchestrator and verify it's present in your tenant.
   * Select your run **Strategy** (for example, **All**). Selecting **All** indicates that you want to run this job a single time, using the next available robot. For more information, see [Templates](https://docs.uipath.com/add-ins/other/latest/user-guide/salesforce-templates#templates).
   * Click the **Next** button.

     ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44977-06d02ae9-76a57e27.webp)
5. Complete the final page of the template form:
   * Select a **Salesforce Object** (for example, **Opportunity**).
   * Select the **Opportunity Fields** that have the data you want as Input Values for your Job (for example, **Opportunity ID**, **Account ID**).
6. Click the **Save** button.

   ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44460-03bcee59-b3cf5e07.webp)
7. Verify the Job Template was added to your list of templates.

   ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44492-416c2b28-d8f43446.webp)

You're done! Next, let's open the Salesforce **Lightning Process Builder** to build a simple automation process that uses your new templates.

### Build an automation process

In this section, you use the Salesforce **Lightning Process Builder** to create a process that invokes your new templates when a Salesforce Opportunity stage is changed to **Closed/Won**.

For more information about the Salesforce Lightning Process Builder, see [Lightning Process Builder](https://help.salesforce.com/articleView?id=process_overview.htm&type=5) in the Salesforce documentation.

1. **Add Object**.
   1. Open the **Lightning Process Builder** (**Settings > Setup > Process Builder**).
   2. In the upper right-hand corner, click the **New** button (this opens the **New Process** window).

      ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-45041-3c3b627c-18a8c954.webp)
   3. Enter your **New Process** details.
   4. For **The process starts when** field, select **A record changes**.
   5. Click the **Save** button (this opens your new process in the builder).

      ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-45045-52dcfa88-98b67bb4.webp)
   6. In the design panel, click **+ Object**.
   7. Enter your object details:
      * Select **Opportunity** for your **Object**.
      * Under **Start the process**, select the **When a record is created or edited** radio button.
   8. Click the **Save** button.

      ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44456-eb976b55-59ae8bad.webp)
2. **Add Criteria**.
   1. In the design panel, click **Add Criteria**.
   2. Enter the following criteria details:
      * Enter a **Criteria Name** (for example, `OpportunityWon`).
      * Under **Criteria for Executing Actions**, select the **Conditions are met** radio button.
      * Under **Set Conditions**, enter/select the following:
        * **Field**: Select **Stage** (displays as **[Opportunity].StageName** when selected)
        * **Operator**: Select **Equals**
        * **Type**: Select **Picklist**
        * **Value**: Select **Closed Won**.
      * Under **Conditions**, select the **All of the conditions are met (AND)** radio button.
   3. Click the **Save** button.

      ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44821-940afa05-433212bc.webp)
3. **Add Immediate Actions**.
   1. In the design panel, click **+Add Action**.
   2. Enter the following action details:
      * Under **Action Type**, select **APEX** (this indicates that you want to use an AppExchange application)
      * Enter an **Action Name** (for example, `CreateQueue`).
      * Under **Apex Class**, select **UiPath - Create Queue Notification**.
      * Under **Set Apex Variables**, enter the following (two rows):
        * **Field**: **Record ID** (default value)
        * **Type**: Select **Field Reference**
        * **Value**: Select **[Opportunity].Id**. This value must match the Object you selected when you created the template.
        * **Field**: **Connection Template Name** (default value)
        * **Type**: Select **String**
        * **Value**: Enter your template name (for example, `OpportunityQueueItem`).
      * Click the **Save** button.

        ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44621-2f098e60-ba540de7.webp)
   3. In the design panel, click **Add Action**.
   4. Enter the following action details:
      * Under **Action Type**, select **APEX** (this indicates that you want to use an AppExchange application).
      * Enter an **Action Name** (for example, `CreateJob`).
      * Under **Apex Class**, select **UiPath - Create Job Notification**.
      * Under **Set Apex Variables**, enter the following (two rows):
        * **Field**: **Connection Template Name** (default value)
        * **Type**: Select **String**.
        * **Value**: Enter your template name (for example, `OpportunityJob`).
        * **Field**: **Record ID** (default value).
        * **Type**: Select **Field Reference**.
        * **Value**: Select **[Opportunity].Id**. This value must match the Object you selected when you created the template.
      * Click the **Save** button.

        ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44825-5d68be04-c0082355.webp)
   5. In the upper right-hand corner, click the **Activate** button (this locks your process and enables it for use).

      ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44657-20929906-26dcd6e5.webp)You're done! Now, let's test your automation process by updating a Salesforce Opportunity.
