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

# Salesforce

> Create a Salesforce Connected App and connect it to Doris from Sources.

Connect Salesforce so Doris can sync Accounts, Contacts, Opportunities, owners, stages, and the deal context attached to your pipeline.

<Note>
  Salesforce is an organization-wide CRM integration. A Doris admin connects it from **Sources > CRM > Salesforce**.
</Note>

## Before you start

You need two things before opening the Doris connection flow:

* A **Doris admin** account for your workspace
* A Salesforce user who can create an External Client App and authorize API access for the org

Use a Salesforce admin or a dedicated integration user with:

* API access enabled
* Read access to **User**, **Account**, **Contact**, and **Opportunity**
* Read access to opportunity stages, owners, and standard opportunity fields
* Write access to **Account**, **Contact**, and **Opportunity** if Doris will update CRM fields
* Create access to **Task** if Doris will write notes or follow-up records back to Salesforce

<Tip>
  A dedicated Salesforce integration user is usually cleaner than using an individual rep's account. It keeps ownership of the integration stable if a team member changes roles.
</Tip>

## 1. Create the Salesforce app

Salesforce requires your organization to create its own External Client App before Doris can run OAuth.

<Steps>
  <Step title="Open Salesforce Setup">
    In Salesforce, open **Setup** and search for **External Client Apps**.
  </Step>

  <Step title="Create an External Client App">
    Create a new app for Doris and enable OAuth. Doris uses the OAuth authorization-code flow with PKCE.
  </Step>

  <Step title="Add the callback URL">
    Add this callback URL exactly:

    ```text theme={null}
    https://server.meetdoris.com/api/v1/crm/salesforce/callback
    ```
  </Step>

  <Step title="Add OAuth scopes">
    Add the Salesforce OAuth scopes Doris needs:

    | Scope                              | Why Doris needs it                                                     |
    | ---------------------------------- | ---------------------------------------------------------------------- |
    | `api`                              | Read and write CRM records through the Salesforce API                  |
    | `refresh_token` / `offline_access` | Keep the connection active without requiring a new login every session |
    | `id`                               | Identify the Salesforce org and user that authorized the connection    |
  </Step>

  <Step title="Copy the credentials">
    Copy the app's **Consumer Key** and **Consumer Secret**. You will paste them into Doris during the connection flow.
  </Step>
</Steps>

## 2. Connect from Doris

After the Salesforce app exists, complete the connection in Doris.

<Steps>
  <Step title="Open Sources">
    Log in to Doris as an admin and go to **Sources** in the sidebar.
  </Step>

  <Step title="Choose Salesforce">
    Open the **CRM** card, choose **Salesforce**, and click **Connect**.
  </Step>

  <Step title="Enter app credentials">
    Paste the Salesforce **Consumer Key** and **Consumer Secret** from the External Client App, then click **Save & Connect**.
  </Step>

  <Step title="Authorize in Salesforce">
    Salesforce opens in a new authorization flow. Sign in as the Salesforce integration user and approve the requested access.
  </Step>

  <Step title="Return to Doris">
    After authorization, Salesforce redirects back to Doris. The Salesforce source should show as connected.
  </Step>
</Steps>

## 3. Select reps and import

The Salesforce source has three setup sections in Doris:

| Section          | What to do                                                                     |
| ---------------- | ------------------------------------------------------------------------------ |
| **Connection**   | Save the Connected App credentials and authorize Salesforce                    |
| **Tracked Reps** | Choose which Salesforce users Doris should track; leave empty to sync all reps |
| **Import**       | Click **Import Data** to bring Salesforce records into Doris                   |

Initial import can take a few minutes depending on the size of your Salesforce org.

## What syncs

| Salesforce         | Doris                              |
| ------------------ | ---------------------------------- |
| Accounts           | Companies                          |
| Contacts           | People                             |
| Opportunities      | Deals                              |
| Users / owners     | Rep ownership and filtering        |
| Opportunity stages | Deal stages and pipeline structure |

Doris reads Salesforce as the source of truth for your CRM records. When CRM writeback or automation is enabled, Doris can also write selected field updates and notes back to Salesforce.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Doris says Connected App credentials are missing">
    Open **Sources > CRM > Salesforce**, click **Connect**, and paste the Consumer Key and Consumer Secret from the Salesforce External Client App. Salesforce cannot be connected without customer-owned app credentials.
  </Accordion>

  <Accordion title="Salesforce rejects the callback URL">
    Confirm the callback URL in Salesforce exactly matches `https://server.meetdoris.com/api/v1/crm/salesforce/callback`. Extra slashes, missing `https`, or an old API domain will cause OAuth to fail.
  </Accordion>

  <Accordion title="The wrong Salesforce org was authorized">
    Disconnect Salesforce in Doris and reconnect using a user from the correct Salesforce org. Doris checks the Salesforce org identity during OAuth.
  </Accordion>

  <Accordion title="Records are missing after import">
    Check the Salesforce integration user's object permissions and field-level security. Doris can only sync records and fields visible to the user who authorized the integration.
  </Accordion>

  <Accordion title="Another CRM is already connected">
    Doris supports one primary CRM connection at a time. Disconnect the existing CRM source before connecting Salesforce.
  </Accordion>
</AccordionGroup>
