> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.app/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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img2.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=c3bf32d82ee852ff0065f5df29449d9d" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img4.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=d43c03e4eb8a8845be1d87419fa46d5b" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img5.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=2532981b0e908cd83c886875c7adc72e" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img6.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=9bf9dcd311d1a58e19d925ae06dfab4d" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img7.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=1a5bbfc73b6d75e2a0225af45a16ea08" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img8.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=3ce272fbf9a458ed9f9a7fa248a8ab99" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img9.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=21eb043971804ea31a45924ef0caa960" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img10.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=c13214e4fb3021b7dd105dc68a1502ee" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img11.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=4f92365d785c1ae8a033b0bb32c28f31" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img12.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=dcf5d3c3e5b0494be3d7ce82ad0190df" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img13.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=767d552e5c93c8ec341401456d743b8f" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img14.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=fa4862f499bd209d5469f0e1a5c29fac" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img15.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=a4ff29f193cc14d539e1b0c834d54265" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img16.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=ce51a6a35f91f7a676beb4a0b4cf719a" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img17.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=bc23b20caaa4d7a14d61c7cf9bc5672f" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img18.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=f5de7d137f97d65b08524e85ca5a6059" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img19.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=8eccbfed388510bbb537eed3045f6ccd" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img20.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=f64fd0102729f44be5da8d7cbedf4846" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img21.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=e2167421c5fbdc26f825f3fe4bc042d9" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img22.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=074cd38bfcad68b905d6cc876a8da8e7" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img23.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=3ce7fc00c3444dbef8d178cbc13eb16b" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img24.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=f8c1ebc387db6df3cfe2dee95f1e1a7c" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img25.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=4b659346a7282997360d6f594895801c" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img26.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=3414839a40c947197c03c978bae3ce36" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img27.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=fe856bd02f1d2b7d9eb0ee7d9dd5871e" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img28.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=cfb876c7357685fe966923ad07137d49" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img29.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=eb4c64dae5d8ad62cc57956ee197a41d" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img30.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=293911356eadeaa249d9e89fd0fd9b32" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img31.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=ccaa85826b814dbe4f7484898a601d32" 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/NuCnGNJCXSVC7wUP/ai-for-service/integrations/actions/images/salesforce-tem-img32.png?fit=max&auto=format&n=NuCnGNJCXSVC7wUP&q=85&s=1ad1c7f6a1813b0e156625e7143a1e7b" alt="View opportunity details" width="548" height="852" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img32.png" />
