Salesforce destination

Send your event data from RudderStack to Salesforce.

Salesforce is an industry leader in enterprise CRM. It offers a suite of enterprise applications revolving around marketing automation, customer engagement and support, application development as well as analytics.

RudderStack lets you identify your leads in Salesforce without having to use the REST APIs.

Find the open source transformer code for this destination in the GitHub repository.


Before you get started, note the following:

  • RudderStack does not support dev instances of Salesforce. See FAQ for more information.
  • Creating a new Salesforce account to use with RudderStack is recommended to protect any confidential information in your existing Salesforce account. However, this is completely optional.
  • To give RudderStack the required API permissions, create 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.
  • For the above user, make sure the password policy is set to Never expires to avoid event delivery issues due to password expiration. See Salesforce documentation for more information on setting the password policy.
  • Make sure to turn off two-factor authentication for your Salesforce account. RudderStack will be unable to authenticate while making requests if 2FA is enabled.
  • 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.

Getting started

Before configuring Salesforce as a destination in RudderStack, verify if the source platform is supported by referring to the table below:

Connection ModeWebMobileServer
Device mode---
Cloud modeSupportedSupportedSupported
To learn more about the difference between cloud mode and device mode in RudderStack, refer to the RudderStack Connection Modes guide.

Once you have confirmed that the source platform supports sending events to Salesforce, follow these steps:

  1. From your RudderStack dashboard, add the source. Then, from the list of destinations, select Salesforce.
  2. Assign a name to your destination and click Next.

Connection settings

To configure Salesforce as a destination in RudderStack, specify the following settings:

  • User Name: Enter your Salesforce username in this field.

The Salesforce API does not support certain special characters in the username.

For example, if you create a secondary user with the email, Salesforce sets the username to that email address by default. However, to work with the Salesforce API you will need to remove the + sign from the username.

  • Password: Enter the password associated with the Salesforce account.

OAuth 2.0 username-password flow is blocked by default in new orgs to avoid any security risks.

Make sure to toggle on the Allow OAuth Username-Password Flows setting to enable this flow for your org. For more information, see the Salesforce documentation.

Salesforce OAuth flow setting
  • Security Token: Enter your Salesforce security token.
  • Map Rudder Properties to Salesforce Properties: This setting is enabled by default and allows you to map the RudderStack event properties to the corresponding Salesforce fields.
  • Sandbox mode: Enable this setting if you are using a Sandbox environment for the integration.
  • Use contact ID for converted leads: Enable this setting if both the lead and contact field mappings are the same.


You can use the identify call to create or update leads in Salesforce.

The following code snippet demonstrates a sample identify call:

rudderanalytics.identify('1hKOmRA4GRlm', {
  name: 'Alex Keener',
  title: 'Mr.',
  email: '',
  company: 'Google Inc.',
  phone: '+1-202-555-0146',
  rating: 'Hot',
  city: 'New Orleans',
  postalCode: '90002',
  country: 'US',
  street: 'Blue Gum Street',
  state: 'LA'
You don’t require a userId to create a lead in Salesforce.

When you call identify, RudderStack checks if the lead already exists using the email property. If yes, the lead/contact is updated with the traits passed in the identify call. If not, a new lead is created in Salesforce.

When you make an identify call with a set of user traits, RudderStack updates the appropriate record in Salesforce depending on whether it is a lead or a contact using its lead or contact ID.

Updating custom fields in Salesforce

To update custom fields in Salesforce using RudderStack, make sure that you first create those fields in Salesforce before sending the data through RudderStack. For more information, see Salesforce Help guide.

As the Salesforce Leads API requireslastName and company to be present, absence of either of these fields will result in RudderStack automatically appending the 'n/a' to both the fields - even if they have been specified in some previous request.

For example, if you want to collect a custom trait in RudderStack named newProp, create a field label named newProp. This will generate an API name as newProp__c. RudderStack automatically appends the __c to any custom trait.


Make sure the casing is consistent.

For example, if the custom fields are created in the camel case, then the traits must be sent to RudderStack in the camel case only.

Updating Salesforce objects

You can create or update any Salesforce object using the identify event. To specify the object type, follow the below schema.

RudderStack looks for the key externalId under context and determines the Salesforce object type by removing the part Salesforce- from the field type. Further, it makes a PATCH request if there is an id present in the request to update the record. Otherwise, a new record is created.


You cannot send an id property when creating new records as it will cause an API failure.

When creating new records, only provide the type: "Salesforce-Contact" portion of the externalId object.

You can pass multiple object types in a single request and RudderStack will create that many requests to Salesforce.

      FirstName: "John",
      LastName: "Gibbs",
      Email: ""
      externalId: [
          type: "Salesforce-Contact",
          id: "sf-contact-id"

In the example above, RudderStack updates the Contact object in Salesforce with id as sf-contact-id and sends the traits object to Salesforce.

By default, RudderStack creates a Lead object in Salesforce and maps the traits to it, as mentioned above. For other objects, RudderStack does not modify the traits; they are sent to Salesforce as it is.

Supported mappings

RudderStack supports and maps the event properties to several standard fields in Salesforce, as listed in the following table:

RudderStack propertySalesforce field
address.accuracy / accuracyAccuracy
company.annualRevenueAnnualRevenue / cityCity / companyCompany / countryCountry
address.countryCode / countryCodeCountryCode
createdAt / createddateCreatedDate
address.latitude / latitudeLatitude
address.longitude / longitudeLongitude
address.postalCode / postalCodePostalCode
address.state / stateState
address.stateCode / stateCodeStateCode
address.street / streetStreet


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.

Follow this Salesforce help article for more information.

Where do I obtain the Security Token?

You can find your security token under Setup > Personal Setup > My Personal Information > Reset My Security Token.

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 currently.

Note that the dev environments (for example, are different from Salesforce’s sandbox environments.

How to fix “No such column ‘X’ on sobject of type Y” errors?

If event delivery to Salesforce fails due to a provided field not existing - 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.

Questions? Contact us by email or on Slack