# Salesforce Source

## Source Info

* The Salesforce Source is an **Object Cloud** source. This means that it sends information (traits) about a thing that exists and persists over time, such as a person or company, and which can be updated over time. Data from this source can only be exported directly to a warehouse, but it can then be used for further analysis. [Learn more about cloud sources.](/docs/segment/connections/sources#cloud-app-sources)

[Salesforce](http://salesforce.com) is a cloud-based customer relationship management (CRM) platform that you can use to store and managae customer and business data. When you add Salesforce as a source to Segment, Segment automatically collects objects like `Accounts`, `Campaigns`, and `Tasks` and syncs them to your data warehouse.

To connect your Salesforce source directly to the [Segment Profiles destination](/docs/segment/connections/destinations/catalog/actions-segment-profiles), see the [Salesforce Unify Direct Integration Guide](/docs/segment/connections/destinations/catalog/actions-segment-profiles/salesforce-source/).

> \[!NOTE]
>
> On March 25, 2024, the Salesforce source upgraded to use Salesforce's API version 58.0. See the [version upgrade changes](#version-upgrade-changes) to learn more.

## Getting started

> \[!NOTE]
>
> You can add multiple instances of this source if you have more than one Salesforce account.

1. From your workspace's **Sources** page, click **Add Source**.
2. Select **Salesforce**.
3. Give the source a name and add labels, if applicable.
4. Select the Salesforce environment you'd like to pull data from. To use data from a Salesforce sandbox environment, select **Sandbox** from the Salesforce Environment dropdown and [contact Segment Support](https://segment.com/help/contact/). The support team will configure your source to use sandbox data.
5. Connect Segment to your Salesforce environment and authorize Segment to connect to it. For Segment to collect and sync your Salesforce data, you must enable API access for the user that you are connecting to Segment with. For information on how to confirm or change API access for a Salesforce user, see Salesforce's [documentation](https://help.salesforce.com/articleView?id=admin_userperms.htm).

> \[!WARNING]
>
> If you encounter an OAuth error when trying to connect to Segment, Salesforce might be restricting access as users are blocked from using uninstalled connected apps. Contact your Salesforce Org admin to allow access to Segment. For more information, see Salesforce's [documentation on Connected App Usage Restrictions Change](https://help.salesforce.com/s/articleView?id=005132365\&type=1).

6. Choose a data warehouse to connect Salesforce to.
7. In the Salesforce source settings, you can customize the source nickname and schema name. The nickname is a label used in the Segment interface, and the schema name is the namespace you query against in your warehouse. Segment recommends that you use something that reflects the source itself, like `Salesforce` for the nickname and `sfdc`, `salesforce`, or `sfdc_prod` for the schema name.
8. Configure Selective Sync to retrieve only specific objects and properties from Salesforce.

## Components

### Sync

The Salesforce source contains a sync component, which means Segment makes requests to the Salesforce API on your behalf on a three hour interval to pull data into Segment. In the initial sync, by default Segment downloads all the Salesforce objects (and their corresponding properties) according to the [Collections Table](#collections). Segment writes the objects into a separate schema, that corresponds to the source instance's schema name you designated upon creation. For example, if you name the schema `sfdc_prod`, the `leads` collection is accessible at `sfdc_prod.leads` in SQL.

If you configure Selective Sync, Segment only retrieves the objects and properties you specify. Use Selective Sync to avoid unnecessary Salesforce API consumption.

> \[!NOTE]
>
> The Salesforce Selective Sync feature is separate from the [Segment Warehouse Selective Sync](/docs/segment/connections/storage/warehouses/warehouse-syncs/#warehouse-selective-sync). Both features let you choose what to sync. The Salesforce Selective Sync impacts the information that Segment collects from Salesforce.

The sync component uses an upsert API, so the data in your warehouse loaded using sync reflects the latest state of the corresponding resource in Salesforce. For example, if `ticket_status` goes from `open` to `closed` between syncs, on its next sync that tickets status will be `closed`.

The source syncs and warehouse syncs are independent processes. Source runs pull your data into the Segment Hub, and warehouse runs flush that data to your warehouse. Sources sync with Segment every three hours. Depending on your Warehouses plan, Segment pushes the Source data to your warehouse on the interval associated with your billing plan.

## Collections

Collections are the groupings of resources Segment pulls from your source. In your warehouse, each collection gets its own table.

| Collection                        | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                          |
| --------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `accounts`                        | object | An individual account, which is an organization involved with your business (such as customers, competitors, and partners). Corresponds to the [Account](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_account.htm) resource in Salesforce.                                                                                                                      |
| `account_contact_roles`           | object | The role that a given Contact plays on an Account. Corresponds to the [AccountContactRole](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_accountcontactrole.htm) resource in Salesforce.                                                                                                                                                                         |
| `account_tags`                    | object | Associates a word or short phrase with an Account. Corresponds to the [AccountTag](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_accounttag.htm) resource in Salesforce.                                                                                                                                                                                         |
| `campaigns`                       | object | A marketing campaign, such as a direct mail promotion, webinar, or trade show. Corresponds to the [Campaign](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_campaign.htm) resource in Salesforce.                                                                                                                                                                 |
| `campaign_members`                | object | The association between a Campaign and either a Lead or Contact. Corresponds to the [CampaignMember](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_campaignmember.htm) resource in Salesforce.                                                                                                                                                                   |
| `campaign_shares`                 | object | Represents a list of access levels to a Campaign along with an explanation of the access level. For example, if you have access to a record because you own it, the Access Level value is Full and Reason for Access value is Owner. Corresponds to the [CampaignShare](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_campaignshare.htm) resource in Salesforce. |
| `campaign_tags`                   | object | Associates a word or short phrase with a Campaign. Corresponds to the [CampaignTag](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_campaigntag.htm) resource in Salesforce.                                                                                                                                                                                       |
| `cases`                           | object | A customer issue such as a customer's feedback, problem, or question. Corresponds to the [Case](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_case.htm) resource in Salesforce.                                                                                                                                                                                  |
| `case_comments`                   | object | A comment that provides additional information about the associated Case. Corresponds to the [CaseComment](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_casecomment.htm) resource in Salesforce.                                                                                                                                                                |
| `case_contact_role`               | object | The role that a given Contact plays on a Case. Corresponds to the [CaseContactRole](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_casecontactrole.htm) resource in Salesforce.                                                                                                                                                                                   |
| `case_solution`                   | object | The association between a particular Case and a particular Solution. Corresponds to the [CaseSolution](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_casesolution.htm) resource in Salesforce.                                                                                                                                                                   |
| `case_tags`                       | object | Associates a word or short phrase with a Case Corresponds to the [CaseTag](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_casetag.htm) resource in Salesforce.                                                                                                                                                                                                    |
| `contacts`                        | object | A contact, which is an individual associated with an Account. Corresponds to the [Contact](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contact.htm) resource in Salesforce.                                                                                                                                                                                    |
| `contact_tags`                    | object | Associates a word or short phrase with a Contact. Corresponds to the [ContactTag](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contacttag.htm) resource in Salesforce.                                                                                                                                                                                          |
| `contracts`                       | object | A contract (a business agreement) associated with an Account. Corresponds to the [Contract](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contract.htm) resource in Salesforce.                                                                                                                                                                                  |
| `contract_tags`                   | object | Associates a word or short phrase with a Contract. Corresponds to the [ContractTag](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contracttag.htm) resource in Salesforce.                                                                                                                                                                                       |
| `dashboards`                      | object | Represents a dashboard, which shows data from custom reports as visual components. Access is read-only. This object is available in API version 20.0 and later. Corresponds to the [Dashboard](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_dashboard.htm) resource in Salesforce.                                                                              |
| `dashboard_tags`                  | object | Associates a word or short phrase with a Dashboard. This object is available inAPI version 20.0 and later. Corresponds to the [DashboardTag](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_dashboardtag.htm) resource in Salesforce.                                                                                                                             |
| `documents`                       | object | A file that a user has uploaded. Unlike Attachment objects, Documents are not attached to a parent object. Corresponds to the [Document](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_document.htm) resource in Salesforce.                                                                                                                                     |
| `document_tags`                   | object | Associates a word or short phrase with a Document. Corresponds to the [DocumentTag](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_documenttag.htm) resource in Salesforce.                                                                                                                                                                                       |
| `events`                          | object | A calendar appointment event. Corresponds to the [Event](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_event.htm) resource in Salesforce.                                                                                                                                                                                                                        |
| `event_tags`                      | object | Associates a word or short phrase with an Event. Corresponds to the [EventTag](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_eventtag.htm) resource in Salesforce.                                                                                                                                                                                               |
| `_group`                          | object | A set of User records. Corresponds to the [Group](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_group.htm) resource in Salesforce.                                                                                                                                                                                                                               |
| `leads`                           | object | A lead, which is a prospect or potential Opportunity. Corresponds to the [Lead](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_lead.htm) resource in Salesforce.                                                                                                                                                                                                  |
| `lead_tags`                       | object | Associates a word or short phrase with a Lead. Corresponds to the [LeadTag](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_leadtag.htm) resource in Salesforce.                                                                                                                                                                                                   |
| `names`                           | object | Non-queryable object that provides information about foreign key traversals when the foreign key has more than one parent. Corresponds to the [Name](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_name.htm) resource in Salesforce.                                                                                                                             |
| `notes`                           | object | A note, which is text associated with an Attachment, Contact, Contract, Opportunity, or custom object. Corresponds to the [Note](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_note.htm) resource in Salesforce.                                                                                                                                                 |
| `note_tags`                       | object | Associates a word or short phrase with a Note. Corresponds to the [NoteTag](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_notetag.htm) resource in Salesforce.                                                                                                                                                                                                   |
| `opportunities`                   | object | An opportunity, which is a sale or pending deal. Corresponds to the [Opportunity](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_opportunity.htm) resource in Salesforce.                                                                                                                                                                                         |
| `opportunity_competitor`          | object | A competitor on an Opportunity. Corresponds to the [OpportunityCompetitor](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_opportunitycompetitor.htm) resource in Salesforce.                                                                                                                                                                                      |
| `opportunity_contact_role`        | object | The role that a Contact plays on an Opportunity. Corresponds to the [OpportunityContactRole](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_opportunitycontactrole.htm) resource in Salesforce.                                                                                                                                                                   |
| `opportunity_field_history`       | object | Represents the history of changes to the values in the fields of an opportunity. Corresponds to the [OpportunityFieldHistory](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_opportunityfieldhistory.htm) resource in Salesforce.                                                                                                                                 |
| `opportunity_product`             | object | An opportunity line item, which is a member of the list of Product2 records associated with an Opportunity, along with other information about those products on that opportunity. Corresponds to the [OpportunityLineItem](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_opportunitylineitem.htm) resource in Salesforce.                                       |
| `opportunity_line_item_schedules` | object | Information about the quantity, revenue distribution, and delivery dates for a particular OpportunityLineItem. Corresponds to the [OpportunityLineItemSchedule](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_opportunitylineitemschedule.htm) resource in Salesforce.                                                                                           |
| `opportunity_stage`               | object | The stage of an Opportunity in the sales pipeline, such as New Lead, Negotiating, Pending, Closed, and so on. Corresponds to the [OpportunityStage](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_opportunitystage.htm) resource in Salesforce.                                                                                                                  |
| `opportunity_tag`                 | object | Associates a word or short phrase with an Opportunity. Corresponds to the [OpportunityTag](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_opportunitytag.htm) resource in Salesforce.                                                                                                                                                                             |
| `period`                          | object | A fiscal period. Corresponds to the [Period](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_period.htm) resource in Salesforce.                                                                                                                                                                                                                                   |
| `price_books`                     | object | A price book that contains the list of products (Product2 records) that your organization sells. Corresponds to the [Pricebook2](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_pricebook2.htm) resource in Salesforce.                                                                                                                                           |
| `price_book_entries`              | object | A product entry (an association between a Pricebook2 and Product2) in a price book. Corresponds to the [PricebookEntry](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_pricebookentry.htm) resource in Salesforce.                                                                                                                                                |
| `products`                        | object | A product that your organization sells. A product is member of the list of items in a Pricebook2. Corresponds to the [Product2](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_product2.htm) resource in Salesforce.                                                                                                                                              |
| `profile`                         | object | A profile, which defines a set of user permissions for performing different operations, such as querying, adding, updating, or deleting information. Corresponds to [Profile](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_profile.htm) resource in Salesforce.                                                                                                 |
| `solutions`                       | object | A detailed description of a customer issue and the resolution of that issue. Corresponds to the [Solution](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_solution.htm) resource in Salesforce.                                                                                                                                                                   |
| `solution_tags`                   | object | Associates a word or short phrase with a Solution. Corresponds to the [SolutionTag](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_solutiontag.htm) resource in Salesforce.                                                                                                                                                                                       |
| `tasks`                           | object | An activity or to-do item to perform or that has been performed. Corresponds to the [Task](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_task.htm) resource in Salesforce.                                                                                                                                                                                       |
| `task_tags`                       | object | Associates a word or short phrase with a Task. Corresponds to the [TaskTag](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_tasktag.htm) resource in Salesforce.                                                                                                                                                                                                   |
| `users`                           | object | A user in your organization. Corresponds to the [User](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_user.htm) resource in Salesforce.                                                                                                                                                                                                                           |
| `user_login`                      | object | Represents the settings that affect a user's ability to log into an organization. This object is available in API version 29.0 and later. Corresponds to the [UserLogin](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_userlogin.htm) resource in Salesforce.                                                                                                    |
| `role`                            | object | A role in your organization. Corresponds to the [UserRole](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_userrole.htm) resource in Salesforce.                                                                                                                                                                                                                   |

### Custom objects

Select and add custom objects from the Selective Sync page in the Salesforce source settings.

### Formula fields

Updates made to formula fields in Salesforce aren't reflected in Segment. If you need to update a formula field, reach out to [Segment support](https://segment.com/help/contact).

### Deleting records

Segment supports the use of soft deletes in Salesforce. If you perform a soft delete on a record in Salesforce, your next one to two warehouses syncs will change the value of `is_deleted` for the associated record to `True`.

Segment does not support hard deletes in Salesforce. Use of hard deletes will result in the data remaining in the warehouse with `is_deleted` set to `False`.

## Collection properties

Segment performs a one-to-one mapping of all publicly available fields (standard and custom) from Salesforce. To see the full list of the standard fields refer to the Salesforce field documentation linked in each collection above.

## Adding destinations

Warehouses are the only supported destination for object-cloud sources.

## Historical data

When a new Object or Collection is enabled, Segment automatically runs a full historical re-sync on that Object.

However, for custom properties/columns, Segment only populates the custom property with data that comes in after the custom field was enabled. In order to populate the new custom field(s) for records that have previously been synced, you need to initiate a manual re-sync.

> \[!NOTE]
>
> Initiating a full re-sync might impact your workspace's [API calls + Object](/docs/segment/guides/usage-and-billing/mtus-and-throughput/#how-is-object-throughput-calculated) usage.

For Salesforce, Segment uses the `SystemModstamp`(system\_modstamp) field to checkpoint collections that sync incrementally. When enabled, Segment syncs collections incrementally. When disabled, Segment syncs collections fully. If you'd like to force a collection to sync fully on the next run to bring in historical data, you can disable the `SystemModstamp` field on the collection, allow the next sync to complete and then re-enable `SystemModstamp` so the collection syncs incrementally in the coming syncs.

If you've added and selected custom fields to an existing collection and would not like to use `SystemModstamp` to bring in historical data, [contact Segment Support](https://segment.com/help/contact/) to configure them to sync. You don't need to include the field names.

## Version upgrade changes

On March 25, 2024, Segment upgraded the Salesforce source integration from version 39.0 to Salesforce's API version 58.0. With the upgrade, there are [deleted fields](#deleted-fields) and [added fields](#added-fields).

All Salesforce sources created after March 25, 2024 use version 58.0.

### Deleted fields

| Change                                                            | Fields                                                                                                                                                                   |
| ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Collections deprecated                                            | `AssistantRecommendationShare`, `AssistantRecommendation`                                                                                                                |
| Columns deprecated from the collections (Column name, Collection) | (`ForeignKeyAssetId, CustomBrandAsset`), (`UserPermissionsMobileUser, User`), (`OptionsRequireHttps, Site`), (`UniqueKey, LoginEvent`), (`OptionsExternalHttps, Domain`) |

### Added fields

Salesforce version 58 has between 350 and 550 newly added collections and between 800 and 1000 new columns. To see which collections and fields you can access in Salesforce version 58, refer to the [Salesforce documentation](https://help.salesforce.com/s/articleView?id=release-notes.rn_api_nc.htm\&release=244\&type=5).

## Troubleshooting

If you' a're syncing data from a Salesforce sandbox environment and see an "Invalid credentials" error, [contact Segment Support](https://segment.com/help/contact/) to configure your Segment source to use sandbox data.
