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

# Salesforce

> Access CRM data from Salesforce

## How it works

The Salesforce connector indexes documents from your Salesforce.
These documents organized around the **Objects** that you indicate. Examples are below.

## Setting up

### Authorization

<Steps>
  <Step title="Log in to Salesforce">
    Log into Salesforce.
    The Salesforce user must be an organization member or have admin access to the data you would like to index.
  </Step>

  <Step title="Open Settings">
    Click the profile avatar and choose Settings.

    <img className="rounded-image" src="https://mintcdn.com/danswer/24Ocig51qMqahMaT/assets/admins/connectors/salesforce/salesforce_1.png?fit=max&auto=format&n=24Ocig51qMqahMaT&q=85&s=c47e61345e3c691cc7c652016ad2a4ef" alt="Salesforce user menu showing path to Settings" width="2277" height="855" data-path="assets/admins/connectors/salesforce/salesforce_1.png" />
  </Step>

  <Step title="Reset security token">
    Select **My Personal Information** → **Reset My Security Token**.

    <img className="rounded-image" src="https://mintcdn.com/danswer/24Ocig51qMqahMaT/assets/admins/connectors/salesforce/salesforce_2.png?fit=max&auto=format&n=24Ocig51qMqahMaT&q=85&s=93318b1c4a4847f06aebb6dd2a58496b" alt="Salesforce settings highlighting Reset My Security Token" width="2823" height="898" data-path="assets/admins/connectors/salesforce/salesforce_2.png" />
  </Step>

  <Step title="Check email for token">
    Check your email for the security token.

    <img className="rounded-image" src="https://mintcdn.com/danswer/24Ocig51qMqahMaT/assets/admins/connectors/salesforce/salesforce_3.png?fit=max&auto=format&n=24Ocig51qMqahMaT&q=85&s=de49153a5cfc9fedc6afe1c1441c28ab" alt="Email example showing Salesforce security token message" width="2269" height="639" data-path="assets/admins/connectors/salesforce/salesforce_3.png" />
  </Step>

  <Step title="Use credentials in Onyx">
    Once the token has been regenerated, you can use it (as well as your username and password)
    to authorize your Onyx connector.
  </Step>
</Steps>

### Indexing

<Steps>
  <Step title="Create a new Salesforce Connector">
    Navigate to the Admin Panel and select the **Salesforce** Connector Tile.
  </Step>

  <Step title="Create a new credential">
    Click on the **Create New** button and provide your **Username**,
    **Password** and the **Security Token** received from the above steps.

    Select the new credential and click **Continue**.
  </Step>

  <Step title="Define the Salesforce Object(s) you wish to index">
    <Accordion title="Simple">
      Enter the [Salesforce
      Object(s)](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_list.htm)
      you wish to index and organize your Onyx documents by.

      * Make sure to use the singular version of object name (e.g. Opportunity instead of
        Opportunities)
      * If no objects are indicated, it will default to indexing by **Account**
      * Each Onyx Document extracted from Salesforce contains all fields and associations of each
        object. For example,
        when indexing each Account we include the fields of the AccountFeed and AccountShare objects as well (but not the
        associations of those objects).
        This can lead to bloated queries and memory intensive indexing in larger salesforce instances.

      <Tip>
        Use the Advanced mode to have finer grain control over what is indexed.
      </Tip>
    </Accordion>

    <Accordion title="Advanced">
      Specify which objects, fields, and associations get indexed with a json object.

      Top level keys are Salesforce Objects, each value is a JSON object specifying:

      * `fields`: a list of strings describing the fields of the object to index
      * `associations`: a JSON object mapping a Salesforce Object associated with the parent object to a list of fields to be indexed for the child object

      ```json Example theme={null}
      {
        "Account": {
          "fields": ["Id", "Name", "Industry", "CreatedDate", "lastModifiedDate"],
          "associations": {
              "Contact": ["Id", "FirstName", "LastName", "Email"],
              "Opportunity": ["Id", "Name", "StageName", "Amount", "CloseDate"]
          }
        },
        "Lead": {
          "fields": ["Id", "FirstName", "LastName", "Company", "Status"],
          "associations": {}
        }
      }
      ```
    </Accordion>
  </Step>

  <Step title="Click on the **Connect** button.">
    Click on the **Connect** button and your connector will be created.
    Onyx will automatically begin indexing your Salesforce data.
  </Step>
</Steps>

### An Example

You indicate you'd like to organize information by **Account** and click connect

<img className="rounded-image" src="https://mintcdn.com/danswer/24Ocig51qMqahMaT/assets/admins/connectors/salesforce/salesforce_4.png?fit=max&auto=format&n=24Ocig51qMqahMaT&q=85&s=bbf73fc2698c59f9ae81a4a705fdd8d4" alt="Onyx Salesforce connector example configuration using Account object" width="1352" height="1438" data-path="assets/admins/connectors/salesforce/salesforce_4.png" />

Onyx will generate a document for every single **Account** in your Salesforce.
Attached to each document will be all the information associated with that **Account**.
This information would also include information from the **Account**'s children objects (E.g.
all associated **Contacts**, **Notes**, etc.).
This means indicating **Account** means that all **Contact**s that are attached to an account will also be grabbed

If you want to index any **Contacts** that aren't attached to any **Accounts**, (as well as **Accounts**),
you would indicate that like so:

<img className="rounded-image" src="https://mintcdn.com/danswer/24Ocig51qMqahMaT/assets/admins/connectors/salesforce/salesforce_5.png?fit=max&auto=format&n=24Ocig51qMqahMaT&q=85&s=400ce6d9699ba844c6530761adb2f1f3" alt="Onyx Salesforce connector advanced JSON configuration for Account and Contact objects" width="1352" height="1542" data-path="assets/admins/connectors/salesforce/salesforce_5.png" />
