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

# Salesforce integration

[Back to list of enterprise systems](https://koreai.mintlify.site/agent-platform/integrations/enterprise-systems.md)

Use the Salesforce integration to create, search, update, and delete CRM records, manage campaigns, cases, tasks, notes, and files, and run reports and queries through Action Tools. It also provides triggers for record, contact, lead, case, file, and field-history events.

| Authentication | Actions | Triggers |
| - | - | - |
| OAuth 2.0 or OAuth 2.0 Client Credentials | ([27](https://koreai.mintlify.site/agent-platform/integrations/enterprise-systems/salesforce#supported-actions)) | ([9](https://koreai.mintlify.site/agent-platform/integrations/enterprise-systems/salesforce#triggers)) |

## Supported actions

| Action | Use it to |
| - | - |
| [Add Contact to Campaign](#add-contact-to-campaign) | Add a contact to a campaign. |
| [Add File to Record](#add-file-to-record) | Upload a file and attach it to a record. |
| [Add Lead to Campaign](#add-lead-to-campaign) | Add a lead to a campaign. |
| [Create Attachment (Legacy)](#create-attachment-legacy) | Create a legacy Attachment record. For modern Salesforce files, use **Add File to Record**. |
| [Create Case](#create-case) | Create a Case. |
| [Create Contact](#create-contact) | Create a Contact. |
| [Create Lead](#create-lead) | Create a Lead. |
| [Create Note](#create-note) | Create a note and attach it to a record. |
| [Create Opportunity](#create-opportunity) | Create an Opportunity. |
| [Create Record](#create-record) | Create a record for a Salesforce object. |
| [Create Task](#create-task) | Create a task. |
| [Delete Opportunity](#delete-opportunity) | Delete an Opportunity. |
| [Delete Record](#delete-record) | Delete a record. |
| [Export Report](#export-report) | Export a Salesforce report as an Excel file. |
| [Find Child Records](#find-child-records) | Find records related to a parent record. |
| [Find Record](#find-record) | Find a record by a field value. |
| [Find Records by Query (Advanced)](#find-records-by-query-advanced) | Find records using a SOQL `WHERE` clause. |
| [Get Record Attachments](#get-record-attachments) | Get classic Attachments and modern Files for a record. |
| [Run Query (Advanced)](#run-query-advanced) | Run a Salesforce query. |
| [Run Report](#run-report) | Run a Salesforce analytics report and return its rows. |
| [Send Email](#send-email) | Send an email to a Contact or Lead. |
| [Update Contact](#update-contact) | Update a Contact. |
| [Update Lead](#update-lead) | Update a Lead. |
| [Update Record](#update-record) | Update a Salesforce record. |
| [Batch Upsert (Advanced)](#batch-upsert-advanced) | Batch upsert records by external ID. |
| [Bulk Upsert (Advanced)](#bulk-upsert-advanced) | Bulk upsert records by external ID. |
| [Custom API Call](#custom-api-call) | Call a Salesforce API endpoint. |

## Triggers

| Trigger | Fires when |
| - | - |
| New Case Attachment | A new Attachment or File is added to a Case. |
| New Contact | A Contact is created. |
| New Field History Event | A tracked field changes on a selected object. |
| New Lead | A Lead is created. |
| New or Updated Record | A record is created or updated on a selected object, optionally filtered by a SOQL condition. |
| New Outbound Message | Salesforce sends an outbound message to the trigger. |
| New Record | A record is created on a selected object, optionally filtered by a SOQL condition. |
| New or Updated File | A Salesforce File (`ContentDocument`) is created or updated. This trigger does not fire for classic Attachments or Notes. |
| New Case in Queue | A new Case is assigned to a selected queue. |

## Prerequisites

* A Salesforce org and a user or integration identity with access to the records and operations your tools need.
* An OAuth app configured in Salesforce for OAuth 2.0 authorization, or a Salesforce My Domain URL and connected-app credentials for OAuth 2.0 Client Credentials.
* For OAuth 2.0, the app must allow the callback URL shown in the Studio auth profile and the requested scopes: `refresh_token`, `full`, and `api`.
* For Client Credentials, Salesforce My Domain is required. Studio supports **Client Secret** and **JWT assertion** authorization methods.

## Set up the integration

**1. Create a Salesforce auth profile**

In **Tools**, select **New Tool** > **Action** > **Salesforce** > **Continue**, then select **Manage profiles**. In **Project Auth Profiles**, select **New Profile** > **Integration Profile** > **Salesforce** > **Continue**. Choose **OAuth 2.0** or **OAuth 2.0 Client Credentials**. For OAuth 2.0, configure the Salesforce hostname if needed, add the profile callback URL to the Salesforce app, and enter the client ID and secret. For Client Credentials, enter the Salesforce My Domain URL, choose **Client Secret** or **JWT assertion**, and provide the matching credentials and settings. Save the profile and authorize it when using OAuth 2.0.

**2. Create the action tool**

In **Tools**, select **New Tool** > **Action** > **Salesforce** > **Continue**. Select the **Action** and **Auth Profile**, configure the inputs, and select **Create Tool**. Then [assign the tool to an agent](https://koreai.mintlify.site/agent-platform/tools/actions.md#assign-an-action-to-an-agent).

## Action reference

The parameters below are the required inputs listed for each action in the connector catalog. Studio may also show optional settings for the selected action; configure those in the tool builder as needed.

> [accordion] Add Contact to Campaign
>
> | Required parameter | Description |
> | - | - |
> | `campaign_id` | ID of the campaign. |
> | `contact_id` | ID of the contact to add. |
> | `status` | Campaign member status. |

> [accordion] Add File to Record
>
> | Required parameter | Description |
> | - | - |
> | `object` | Salesforce object type for the record. |
> | `record_id` | ID of the record to attach the file to. |
> | `file` | File content to upload. |
> | `file_name` | Name for the uploaded file. |

> [accordion] Add Lead to Campaign
>
> | Required parameter | Description |
> | - | - |
> | `campaign_id` | ID of the campaign. |
> | `lead_id` | ID of the lead to add. |
> | `status` | Campaign member status. |

> [accordion] Create Attachment (Legacy)
>
> | Required parameter | Description |
> | - | - |
> | `object` | Salesforce object type for the parent record. |
> | `parent_id` | ID of the record to attach the legacy Attachment to. |
> | `file` | File content. |
> | `file_name` | Name for the Attachment. |

> [accordion] Create Case
>
> | Required parameter | Description |
> | - | - |
> | `Subject` | Case subject. |

> [accordion] Create Contact
>
> | Required parameter | Description |
> | - | - |
> | `LastName` | Contact last name. |

> [accordion] Create Lead
>
> | Required parameter | Description |
> | - | - |
> | `LastName` | Lead last name. |
> | `Company` | Lead company. |

> [accordion] Create Note
>
> | Required parameter | Description |
> | - | - |
> | `object` | Salesforce object type for the parent record. |
> | `parent_id` | ID of the record to attach the note to. |
> | `Title` | Note title. |
> | `Body` | Note content. |

> [accordion] Create Opportunity
>
> | Required parameter | Description |
> | - | - |
> | `Name` | Opportunity name. |
> | `CloseDate` | Opportunity close date. |
> | `StageName` | Opportunity stage. |

> [accordion] Create Record
>
> | Required parameter | Description |
> | - | - |
> | `object` | Salesforce object type. |
> | `data` | Field values for the record. |

> [accordion] Create Task
>
> | Required parameter | Description |
> | - | - |
> | `Subject` | Task subject. |
> | `OwnerId` | ID of the task owner. |
> | `Status` | Task status. |
> | `Priority` | Task priority. |

> [accordion] Delete Opportunity
>
> | Required parameter | Description |
> | - | - |
> | `opportunity_id` | ID of the Opportunity to delete. |

> [accordion] Delete Record
>
> | Required parameter | Description |
> | - | - |
> | `object` | Salesforce object type. |
> | `record_id` | ID of the record to delete. |

> [accordion] Export Report
>
> | Required parameter | Description |
> | - | - |
> | `report_id` | ID of the Salesforce report to export. |

> [accordion] Find Child Records
>
> | Required parameter | Description |
> | - | - |
> | `parent_object` | Salesforce object type of the parent. |
> | `parent_id` | ID of the parent record. |
> | `child_relationship` | Child relationship to search. |

> [accordion] Find Record
>
> | Required parameter | Description |
> | - | - |
> | `object` | Salesforce object type. |
> | `field` | Field to search. |
> | `search_value` | Value to find in the field. |

> [accordion] Find Records by Query (Advanced)
>
> | Required parameter | Description |
> | - | - |
> | `object` | Salesforce object type. |
> | `where_clause` | SOQL `WHERE` clause used to filter records. |

> [accordion] Get Record Attachments
>
> | Required parameter | Description |
> | - | - |
> | `object` | Salesforce object type. |
> | `record_id` | ID of the record whose attachments and files to retrieve. |

> [accordion] Run Query (Advanced)
>
> | Required parameter | Description |
> | - | - |
> | `query` | Salesforce query to run. |

> [accordion] Run Report
>
> | Required parameter | Description |
> | - | - |
> | `report_id` | ID of the Salesforce report to run. |

> [accordion] Send Email
>
> | Required parameter | Description |
> | - | - |
> | `recipientId` | Salesforce Contact or Lead ID. |
> | `subject` | Email subject. |
> | `body` | Email body. |

> [accordion] Update Contact
>
> | Required parameter | Description |
> | - | - |
> | `contact_id` | ID of the Contact to update. |

> [accordion] Update Lead
>
> | Required parameter | Description |
> | - | - |
> | `lead_id` | ID of the Lead to update. |

> [accordion] Update Record
>
> | Required parameter | Description |
> | - | - |
> | `object` | Salesforce object type. |
> | `record_id` | ID of the record to update. |
> | `data` | Field values to update. |

> [accordion] Batch Upsert (Advanced)
>
> | Required parameter | Description |
> | - | - |
> | `object` | Salesforce object type. |
> | `external_field` | External ID field used to match records. |
> | `records` | Records to upsert. |

> [accordion] Bulk Upsert (Advanced)
>
> | Required parameter | Description |
> | - | - |
> | `object` | Salesforce object type. |
> | `external_field` | External ID field used to match records. |
> | `records` | Records to upsert in bulk. |

> [accordion] Custom API Call
>
> | Required parameter | Description |
> | - | - |
> | `url` | Salesforce API endpoint URL. |
> | `method` | HTTP method for the request. |
> | `headers` | Request headers. |
> | `queryParams` | Query string parameters. |

## Trigger reference

> [accordion] New Case Attachment
>
> No input parameters. Fires when a new Attachment or File is added to a Case.

> [accordion] New Contact
>
> No input parameters. Fires when a Contact is created.

> [accordion] New Field History Event
>
> | Parameter | Required | Description |
> | - | - | - |
> | `object` | Yes | Salesforce object with field history tracking enabled. |

> [accordion] New Lead
>
> No input parameters. Fires when a Lead is created.

> [accordion] New or Updated Record
>
> | Parameter | Required | Description |
> | - | - | - |
> | `object` | Yes | Salesforce object to monitor. |
> | `conditions` | No | Optional SOQL `WHERE` clause for filtering, for example `IsDeleted = TRUE`. |

> [accordion] New Outbound Message
>
> No input parameters. Configure a Salesforce outbound message to send events to the trigger endpoint.

> [accordion] New Record
>
> | Parameter | Required | Description |
> | - | - | - |
> | `object` | Yes | Salesforce object to monitor. |
> | `conditions` | No | Optional SOQL `WHERE` clause for filtering, for example `IsDeleted = TRUE`. |

> [accordion] New or Updated File
>
> No input parameters. Monitors Salesforce Files (`ContentDocument`); it does not fire for classic Attachments or Notes. |

> [accordion] New Case in Queue
>
> | Parameter | Required | Description |
> | - | - | - |
> | `caseQueueId` | Yes | Salesforce Case queue to monitor. |

## Troubleshoot common issues

| Issue | Resolution |
| - | - |
| OAuth authorization fails | Check the Salesforce hostname, client credentials, callback URL, and requested scopes. For a sandbox or custom domain, use the appropriate Salesforce hostname. |
| Client Credentials authorization fails | Confirm the My Domain URL, client ID, and the selected Client Secret or JWT assertion configuration. |
| An action can't find or update a record | Verify the object and record IDs and confirm that the authorized Salesforce identity has the required object and field permissions. |
| A query or report fails | Check the SOQL syntax and confirm the authorized identity can access the referenced objects, fields, and report. |
| A trigger doesn't return expected events | Check the selected object, queue, and SOQL condition. For **New Outbound Message**, confirm Salesforce is configured to send the outbound message to the trigger endpoint. |
| A file trigger misses an attachment | **New or Updated File** covers `ContentDocument` files, not classic Attachments or Notes. Use **New Case Attachment** for files attached to Cases. |

## Related articles

* [Auth profiles](https://koreai.mintlify.site/agent-platform/administration/integrations-settings.md#auth-profiles)
* [Action Tools](https://koreai.mintlify.site/agent-platform/tools/actions.md)
* [Salesforce developer documentation](https://developer.salesforce.com/docs/)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.