> ## Documentation Index
> Fetch the complete documentation index at: https://koreai-ai-for-work-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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img2.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=dbc060505fa0519231d6fd0fe964d157" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img4.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=392797c0784dc7c747944da9272e2b8e" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img5.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=5c8f18036c0b83f32f9649618e57e31d" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img6.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=d55fc609cbc573d61ccb6727883a411e" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img7.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=33796e9bb088b1eca68e3c6807bb706f" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img8.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=a7af86f7c935c03ead73e237f96690df" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img9.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=9cb99a30c52e13f70ef0cb8f37b2100b" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img10.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=84962658f26be2149d953608d01781a6" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img11.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=9f8bd4bc8240444b313a27f5679ab7d0" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img12.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=aca94da83e7b8db88efd5d3eb4b20da3" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img13.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=669cd69bd23033df5ad53c62b9158779" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img14.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=23b921b81a73d2d73bffe7102a7180e0" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img15.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=c8c5cbdc7b99b35978108ff9a377a6bd" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img16.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=fe5033a728d8a1a533c59d172450a4ba" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img17.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=7470a87d3f9194ded9d4c3d44bb3c1db" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img18.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=617edf52817fbef00b2f7069a7564add" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img19.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=083050b5930b4f9a449582c5ba7aea0e" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img20.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=bb7db188ecd6489faf8e77988641b7f1" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img21.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=cf6c0a437298e699732af9ab88e0613e" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img22.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=3e67e2f5f8b738aadcb7d029fa165baf" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img23.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=6c6e2c5db41d927db651ed88b6f7bf79" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img24.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=04f06521b91b90c021d63458bd3f1f56" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img25.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=e46002999fe07a122f3d223ab1f72193" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img26.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=005d4fae8dcdf0d5bd5a307972743dfc" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img27.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=d7c257350e00b6536a88a9eca2470f7f" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img28.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=39d7c5ebc7153e4dba66e72bd46cdacc" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img29.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=c5a623aa57dc1030c768092cb948d86f" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img30.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=cc68557ba3226b7e51164e244cb2b059" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img31.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=62a2f1689d680d645aae2d8ff2072119" 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-work-dev/3UARiMNGb-Jvq0lb/ai-for-service/integrations/actions/images/salesforce-tem-img32.png?fit=max&auto=format&n=3UARiMNGb-Jvq0lb&q=85&s=5dde6ef2df2fdb218e5158a2b6a751eb" alt="View opportunity details" width="548" height="852" data-path="ai-for-service/integrations/actions/images/salesforce-tem-img32.png" />
