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

# Salesforce

> Query Salesforce opportunities, accounts, leads and contacts live from Explore and AI agents

The Salesforce [live data source](https://docs.lightdash.com/integrations/live-data-sources) reads opportunities, accounts, leads and contacts from your Salesforce org, one table each. Salesforce computes counts, sums and averages with SOQL, so most questions take one API call. It's a [level 4](https://docs.lightdash.com/integrations/live-data-sources#integration-levels) integration: its API runs its own query language, including totals.

## Before you start

* **Live data sources enabled** for your organization. See [Live data sources](https://docs.lightdash.com/integrations/live-data-sources).
* **Admin role** in the Lightdash project.
* **A Salesforce user with the "API Enabled" permission** and read access to the objects you want to query.
* **A production org**, such as a company org or a Developer Edition org. Sandbox orgs aren't supported.

If Salesforce shows a **Request** button instead of connecting, your instance doesn't have a Salesforce Connected App. On a self-hosted instance, [configure one](https://docs.lightdash.com/self-host/enterprise-features#live-data-sources).

## Connect Salesforce

1. On the nav bar, click **Browse** → **Semantic Layer**.
2. In the sidebar, select **Live data sources**, then click **Add**.
3. Select **Salesforce**.
4. Enter a **Name**, such as `Salesforce`.
5. Click **Continue to Salesforce**, sign in and allow access.

Lightdash checks that the user can read at least one of the objects, then adds **Opportunities**, **Accounts**, **Leads** and **Contacts** tables to Explore. A table whose object the user can't read keeps only its built-in fields.

Connecting also scans each object's own fields, including custom fields. Scanned fields start hidden. Turn on the ones you want, and scan again after adding fields in Salesforce.

## Fields

| Field | Notes |
| - | - |
| Record ID, Created date | On every object |
| Created day, month, quarter, year | In UTC |
| Count | Number of records |
| Text, picklist, ID, checkbox and whole-number fields | Dimensions. Picklists list their values for AI agents |
| Lookups, such as Owner | The ID, plus the related record's name |
| Date and date-time fields | The day, plus month, quarter and year |
| Currency, number and percent fields | Sum, average, minimum and maximum metrics. No sum for percent |

Long text areas, multi-select picklists and hidden fields aren't available.

## Supported features

| Feature | Available |
| - | - |
| Filters, including OR and nested groups | Yes |
| Filters on metrics | Yes, with at least one dimension |
| Filters on a month, quarter or year | No. Filter the date or day instead |
| Sorting and limits | Yes |
| Table calculations, custom metrics and custom dimensions | No |
| Period-over-period comparisons, pivots and date zoom | No |

## Limits

| Limit | Value |
| - | - |
| Rows with metrics | 1,999 per query |
| Rows without metrics | 9,999 per query |
| Timeout | 60 seconds per call |
| Calls at once | 2 per source |
| Calls per minute | 60 per source |
| Calls per hour | 500 per source |

A query with metrics is one call to Salesforce. A list of records without metrics takes one call for every 2,000 rows. When a query has more rows than these limits, Lightdash shows an error rather than a partial result.

Calls count toward your org's daily API limit.

## Example questions

* *"Open pipeline amount by stage."*
* *"Opportunities won per month this year, by owner."*
* *"Leads created last week by source."*

## Troubleshooting

**The org has used its API calls for the last 24 hours.** Salesforce limits API calls per org. Try again later or ask your Salesforce admin about the limit.

**The API isn't enabled for this user.** Give the user the "API Enabled" permission, then choose **Sign in again**.

**A field doesn't exist.** The field was renamed or removed in Salesforce. Scan the source again.


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