# Setup Guide


This guide will help you set up Salesforce as a destination in the RudderStack dashboard. It also lists the configuration settings required to correctly send data from the supported sources to Salesforce.

{{< announcement >}}
**This integration does not support dev instances of Salesforce**. See [FAQ](#does-rudderstack-support-dev-instances-of-salesforce) for more information.
{{< /announcement >}}

## Important: Prerequisites

Before you get started, note the following:

- **Optional but recommended**: Create a new Salesforce account to use with RudderStack to protect any confidential information in your existing Salesforce account.

    - To give RudderStack the required API permissions, add a new user account in your Salesforce dashboard by going to **Setup** > **Administration Setup** > **Users** > **New User** and select **System Administrator** as the profile type.

{{< warning >}}
The user account you create must have the [Approve Uninstalled Connected Apps](https://help.salesforce.com/s/articleView?id=005132365&type=1#:~:text=New%20Approve%20Uninstalled%20Connected%20Apps%20user%20permission) permission. Alternatively, reach out to your admin to install the app.

Otherwise, you might encounter an [OAuth error](#why-am-i-getting-an-oauth-error-during-setup) during setup.
{{< /warning >}}

- Make sure to **turn off** two-factor authentication for your Salesforce account so that RudderStack can authenticate successfully.
- Make sure the Salesforce objects are searchable and fields are creatable before sending events. Otherwise, it can result in errors during event transformation or delivery.

## Connection compatibility

{{< destination-config >}}

## Setup

In your [RudderStack dashboard](https://app.rudderstack.com/), add a source. Then, from the list of destinations, select **Salesforce v2**.

### Connection settings

| Setting | <div style="width:350px">Description</div> |
| :----| :-----|
| Name | Assign a name to uniquely identify the destination in RudderStack. |
| Event delivery account | <ol><li>Click **Create Account** > **OAuth** and specify an account name.</li><li>Specify the **Environment type** from the dropdown — RudderStack supports both **Production** and **Sandbox** environments.</li><li>Click **Connect account**, log in to Salesforce, and grant RudderStack the necessary permissions to access your account.</li></ol> |

### Configuration settings

| Setting | <div style="width:350px">Description</div> |
| :----| :-----|
| Map RudderStack properties to Salesforce properties | This setting is toggled on by default and lets you map the RudderStack event properties to the corresponding Salesforce fields. |
| Use contact ID for converted leads | Toggle on this setting if both the lead and contact fields are the same. | 
| Consent management settings | Specify the **Consent management provider** from the dropdown and enter the corresponding consent category IDs. <br /><br />See the [Consent Management]({{< ref "data-governance/consent-management/" >}}) guide for more information on configuring the consent settings. | 

## Next steps

- [Send events in cloud mode]({{< ref "destinations/streaming-destinations/salesforce-v2/cloud-mode.md" >}})

## FAQ

#### Why am I getting an OAuth error during setup?

If you are getting the below OAuth error while connecting to Salesforce, make sure the [user account](#important-prerequisites) you created has the [Approve Uninstalled Connected Apps](https://help.salesforce.com/s/articleView?id=005132365&type=1#:~:text=New%20Approve%20Uninstalled%20Connected%20Apps%20user%20permission) permission.

{{< image src="images/event-stream-destinations/salesforce-v2/salesforce-v2-oauth-error.webp" alt="Salesforce OAuth error" >}}

#### Which Salesforce Edition should I use to access the API?

Before connecting to the Salesforce API with RudderStack, make sure you are using the right Salesforce edition. You must have either the **Enterprise**, **Unlimited**, **Developer**, or **Performance** editions to access the API.

See this [Salesforce help article](https://help.salesforce.com/articleView?id=000326486&type=1&mode=1) for more information.

#### How do I check the number of Salesforce API calls left for the day?

To check the number of Salesforce API calls, go to **Setup** > **Administration Setup** > **Company Profile** > **Company Information**. You should then be able to see a field called **API Requests, Last 24 Hours**, which contains the number of API calls left for the day.

#### Does RudderStack support dev instances of Salesforce?

No, RudderStack does not support Salesforce dev instances (for example, `https://companyabc-dev-ed-develop.lightning.force.com/`) currently.

#### How to fix "No such column 'X' on object of type Y" errors?

If event delivery to Salesforce fails due to the non-existence of a provided field - even though the field does exist - check the field-level security settings for that field in Salesforce.

When the field is **not** marked as visible to the role your RudderStack Salesforce user is using, you will get this error. To fix it, make the field visible to the appropriate role.

<br />
