> ## Documentation Index
> Fetch the complete documentation index at: https://koreai-ai-for-service-dev.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Using the Salesforce CRM Action Templates

<Badge icon="arrow-left" color="gray">[Back to Actions Integrations](/ai-for-service/integrations/overview#actions)</Badge>

Use prebuilt Salesforce CRM action templates to auto-create dialog tasks for managing leads and opportunities.

**To access templates:**

1. Go to **Automation AI** > **Use Cases** > **Dialogs** and click **Create a Dialog Task**.

2. Under **Integration**, select **Salesforce**.

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img2.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=d1f034fdb7ebdb42d1917458ca0cf4a2" alt="Integration - Salesforce" width="1196" height="908" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img2.png" />

3. If no integration is configured, click **Explore Integrations** to set one up. See [Actions Overview](/ai-for-service/integrations/overview#actions).

***

## Supported Actions

| Task                  | Description                              | Method |
| --------------------- | ---------------------------------------- | ------ |
| Create a Lead         | Creates a new marketing lead in the CRM. | POST   |
| Create an Opportunity | Creates a new opportunity in the CRM.    | POST   |
| Update a Lead         | Updates the lead with changes.           | PATCH  |
| View a Lead By ID     | Retrieves the lead details.              | GET    |
| List All Leads        | Retrieves all leads from the CRM.        | GET    |
| Search Leads          | Searches all leads that match a keyword. | GET    |
| Delete a Lead         | Deletes a lead.                          | DELETE |

***

### Create a Lead

1. Install the template from [Salesforce Action Templates](/ai-for-service/integrations/actions/configuring-the-salesforce-crm-action#step-2-install-the-salesforce-action-templates).

2. The **Create a Lead** dialog task is added with the following components:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img4.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=07b9622036d2164c2eb1e66feccdda1b" alt="createLeadService bot action component properties" width="685" height="699" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img4.png" />

   * **Createlead** - User intent to create a lead.

   * **firstName**, **lastName**, **companyName** - Entity nodes for lead details.

   * **CreateLeadService** - Bot action service to create a lead. Click **Edit Request**:

     <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img5.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=f532ba4efaeca2adaeaa0a4a0ccdaf57" alt="Edit request" width="1919" height="877" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img5.png" />

     **Sample Request:**

     ```json theme={null}
     {
       "attributes": {"type": "Lead"},
       "LastName": "Doe",
       "FirstName": "John",
       "Company": "ABC",
       "MobilePhone": "93445667xx",
       "Status": "Open - Not Contacted",
       "OwnerId": "0055g00000ECRvPAAX",
       "IsConverted": false
     }
     ```

     Click **+Add Response**:

     <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img6.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=b65e30c0121208be5f9ded98d3a456de" alt="Add response" width="1014" height="448" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img6.png" />

     **Sample Response:**

     ```json theme={null}
     {
       "id": "00Q5g00000DZ0d4EAD",
       "success": true,
       "errors": []
     }
     ```

   * **subDomainService** - Bot action service to fetch subdomain.

     <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img7.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=51e1d83cbf20b6ef35a5e08bd74a9730" alt="subDomainService bot action component properties" width="677" height="654" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img7.png" />

   * **createLeadMessage** - Message node to display responses.

3. Click **Train**, then **Talk to Bot** to test:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img8.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=99d8d93bac56e5364471687823f3458b" alt="VA prompts to create a lead" width="563" height="851" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img8.png" />

4. Enter lead details when prompted:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img9.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=cbf777d4e53f5f8a88292960f9063f2c" alt="Enter lead details" width="554" height="853" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img9.png" />

5. The new lead is created in Salesforce CRM:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img10.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=b2e9aaae4a5d7dcb0f5c85f94ce24eea" alt="New lead created" width="481" height="594" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img10.png" />

6. Click **View Lead** to see lead details:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img11.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=d41668b99a61ee522b320c257e9b28f8" alt="View lead details" width="1038" height="547" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img11.png" />

***

### Update a Lead

1. Install the template from [Salesforce Action Templates](/ai-for-service/integrations/actions/configuring-the-salesforce-crm-action#step-2-install-the-salesforce-action-templates).

2. The **Update a Lead** dialog task is added with the following components:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img12.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=c80fac6a96d7d871ace7fc6446a92bb1" alt="Update a Lead dialog task is added" width="1712" height="780" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img12.png" />

   * **Update lead** - User intent to update a lead.

   * **Id**, **AskOptions**, **LeadStatus**, **Title**, **MobilePhone** - Entity nodes for update details.

   * **updateLeadScript** - Bot action script to update a lead.

     <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img13.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=0b23be2dbfe2dba7ac2ecbcbc584516a" alt="updateLeadScript bot action component properties" width="1033" height="481" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img13.png" />

   * **updateLeadService** - Bot action service to update a lead.

   * **subDomainService** - Bot action service to fetch subdomain.

   * **updateLeadMessage** - Message node to display responses.

3. Click **Train**, then **Talk to Bot** to test. After entering lead details, the lead is updated in Salesforce CRM. Click **View Lead** to see updated details:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img14.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=5927bf41400f873e3c570d38418fa515" alt="View lead details" width="1038" height="547" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img14.png" />

***

### Delete a Lead

1. Install the template from [Salesforce Action Templates](/ai-for-service/integrations/actions/configuring-the-salesforce-crm-action#step-2-install-the-salesforce-action-templates).

2. The **Delete Lead** dialog task is added with the following components:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img15.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=c6a25c7c95d6631cc5b9d012ef5f33e9" alt="Delete Lead dialog task is added" width="1515" height="916" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img15.png" />

   * **Delete Lead** - User intent to delete a lead.

   * **ID** - Entity node for the lead ID.

   * **deleteLeadService** - Bot action service to delete a lead.

     <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img16.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=3ec27fa0a436cca4933bb33bbeb02d7d" alt="deleteLeadService bot action component properties" width="1901" height="907" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img16.png" />

   * **deleteLeadMessage** - Message node to display responses.

3. Click **Train**, then **Talk to Bot** to test:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img17.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=2e277a4339ba7f9af52b3d7fa30c2250" alt="VA prompt to delete a lead" width="549" height="737" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img17.png" />

***

### List All Leads

1. Install the template from [Salesforce Action Templates](/ai-for-service/integrations/actions/configuring-the-salesforce-crm-action#step-2-install-the-salesforce-action-templates).

2. The **List All Leads** dialog task is added with the following components:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img18.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=b645f6f57909e138a15d5f179d9c4bcc" alt="List All Leads dialog task is added" width="1514" height="901" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img18.png" />

   * **List All Lead** - User intent to list all leads.

   * **listAllLeadsService** - Bot action service to fetch all leads. Click **+Add Response**:

     <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img19.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=a544c32495cc56ff9990ec2eb3a6674f" alt="listAllLeadsService bot action component properties" width="1913" height="835" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img19.png" />

   * **subDomainService** - Bot action service to fetch subdomain.

   * **listAllLeadsMessage** - Message node to display responses.

3. Click **Train**, then **Talk to Bot** to test:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img20.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=a79b0950530c60e6410ba1409b528620" alt="VA prompts to view all leads" width="512" height="743" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img20.png" />

***

### View a Lead By ID

1. Install the template from [Salesforce Action Templates](/ai-for-service/integrations/actions/configuring-the-salesforce-crm-action#step-2-install-the-salesforce-action-templates).

2. The **View Lead by Id** dialog task is added with the following components:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img21.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=42921a8c82d362e16a30c12685dc2f8c" alt="View Lead by Id dialog task is added" width="1470" height="910" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img21.png" />

   * **View Lead by Id** - User intent to view a lead by ID.

   * **ID** - Entity node for the lead ID.

   * **viewLeadbyIdService** - Bot action service to view a lead by ID. Click **+Add Response**:

     <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img22.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=c85f19c81a85bbaeb67658f387157148" alt="Add response" width="1914" height="901" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img22.png" />

   * **subDomainService** - Bot action service to fetch subdomain.

   * **viewLeadbyIdMessage** - Message node to display responses.

3. Click **Train**, then **Talk to Bot** to test:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img23.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=999e291d1515ac5264e7c02c0093266d" alt="VA prompts to view lead by id" width="512" height="720" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img23.png" />

***

### Search Leads

1. Install the template from [Salesforce Action Templates](/ai-for-service/integrations/actions/configuring-the-salesforce-crm-action#step-2-install-the-salesforce-action-templates).

2. The **Search Leads** dialog task is added with the following components:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img24.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=cf7bf5cbc74206fb6035abe45d5db38d" alt="Search Leads dialog task is added" width="1703" height="877" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img24.png" />

   * **Search Leads** - User intent to search leads.

   * **Keyword** - Entity node for search keywords.

   * **searchLeadsService** - Bot action service to search leads. Click **+Add Response**:

     <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img25.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=3641ecac6689e485df25b4ee1fd4be69" alt="Add response" width="1914" height="835" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img25.png" />

   * **subDomainService** - Bot action service to fetch subdomain.

   * **searchLeadsMessage** - Message node to display responses.

3. Click **Train**, then **Talk to Bot** to test:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img26.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=f77f5876459fbf3e1ee53f4f98c4bceb" alt="VA prompt to view all leads" width="550" height="838" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img26.png" />

***

### Create an Opportunity

1. Install the template from [Salesforce Action Templates](/ai-for-service/integrations/actions/configuring-the-salesforce-crm-action#step-2-install-the-salesforce-action-templates).

2. The **Create Opportunity** dialog task is added with the following components:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img27.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=9953a94d5b32ccb582628413fcdb53e0" alt="Create Opportunity dialog task is added" width="1517" height="910" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img27.png" />

   * **Create Opportunity** - User intent to create an opportunity.

   * **Opportunity Name**, **Closed Date**, **Stage of Opportunity** - Entity nodes for opportunity details.

   * **CreateOpportunityService** - Bot action service to create an opportunity. Click **Edit Request**:

     <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img28.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=dd729b83f7b4265bb7e222f4def6587c" alt="Edit request" width="1919" height="833" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img28.png" />

     **Sample Request:**

     ```json theme={null}
     {
       "attributes": {"type": "Opportunity"},
       "Name": "Project Charlie",
       "CloseDate": "2022-08-31",
       "StageName": "Prospecting"
     }
     ```

     Click **+Add Response**:

     <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img29.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=1962b00e85377acbb2ea17d0328b7b87" alt="Add response" width="1914" height="835" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img29.png" />

     **Sample Response:**

     ```json theme={null}
     {
       "id": "0065g00000O4bgDAAR",
       "success": true,
       "errors": []
     }
     ```

   * **subDomainService** - Bot action service to add subdomain.

   * **createOpportunityMessage** - Message node to display responses.

3. Click **Train**, then **Talk to Bot** to test:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img30.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=9055c19a7fa9e87dacfb2d0fb9a97358" alt="VA prompts to create opportunity" width="550" height="845" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img30.png" />

4. Click the **Chevron** icon to expand the new opportunity:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img31.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=b04cd364571405b13d4c61e756b4a537" alt="Expand the new opportunity" width="552" height="781" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img31.png" />

5. Click **View Opportunity** to see opportunity details in Salesforce CRM:

   <img src="https://mintcdn.com/koreai-ai-for-service-dev/8Obw8LCY3UfPmU6e/ai-for-service/integrations/actions/images/salesforce-tem-img32.png?fit=max&auto=format&n=8Obw8LCY3UfPmU6e&q=85&s=fd2644d37b627a572eb1941627a93550" alt="View opportunity details" width="548" height="852" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img32.png" />
