Salesforce v2 Cloud Mode Integration
Send events to Salesforce using RudderStack cloud mode.
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.
Identify
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: 'alex@example.com',
company: 'Google Inc.',
phone: '+1-202-555-0146',
rating: 'Hot',
city: 'New Orleans',
postalCode: '90002',
country: 'US',
street: 'Blue Gum Street',
state: 'LA'
});
When you make an identify
call, 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
event. If not, RudderStack creates a new lead in Salesforce.
Note that:
- You don’t require a
userId
to create a lead 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.
Update 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. See the Salesforce Help guide for more information.
As the Salesforce Leads API requireslastName
and company
to be present, absence of either of these fields results in RudderStack automatically appending the 'n/a'
to both the fields - even if you have specified them 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 you create the custom fields in camel case, then you must send the traits to RudderStack in camel case only.
Update 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, it creates a new record in Salesforce.
Note that:
- You cannot send an
id
property when creating new records as it will lead to 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 creates that many requests to Salesforce, as shown:
rudderanalytics.identify('123456',
{
FirstName: "John",
LastName: "Gibbs",
Email: "john@peterson.com"
},
{
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. RudderStack does not modify the traits
for other objects - they are sent to Salesforce as is.
Supported mappings
RudderStack supports and maps the event properties to several standard fields in Salesforce, as listed in the following table:
RudderStack property | Salesforce field |
---|
address.accuracy / accuracy | Accuracy |
company.annualRevenue | AnnualRevenue |
address.city / city | City |
company.name / company | Company |
address.country / country | Country |
address.countryCode / countryCode | CountryCode |
convertedAccountId | ConvertedAccountId |
convertedContactId | ConvertedContactId |
convertedDate | ConvertedDate |
convertedOpportunityId | ConvertedOpportunityId |
createdById | CreatedById |
createdAt / createddate | CreatedDate |
description | Description |
email | Email |
emailBouncedDate | EmailBouncedDate |
emailBouncedReason | EmailBouncedReason |
firstName | FirstName |
geocodeAccuracy | GeocodeAccuracy |
id | Id |
company.industry | Industry |
individualId | IndividualId |
isConverted | IsConverted |
isDeleted | IsDeleted |
isUnreadByOwner | IsUnreadByOwner |
jigsaw | Jigsaw |
jigsawContactId | JigsawContactId |
lastActivityDate | LastActivityDate |
lastModifiedById | LastModifiedById |
lastModifiedDate | LastModifiedDate |
lastName | LastName |
lastReferencedDate | LastReferencedDate |
lastViewedDate | LastViewedDate |
address.latitude / latitude | Latitude |
LeadSource | LeadSource |
address.longitude / longitude | Longitude |
masterRecordId | MasterRecordId |
name | Name |
company.employee_count | NumberOfEmployees |
ownerId | OwnerId |
phone | Phone |
photoUrl | PhotoUrl |
address.postalCode / postalCode | PostalCode |
rating | Rating |
salutation | Salutation |
address.state / state | State |
address.stateCode / stateCode | StateCode |
status | Status |
address.street / street | Street |
systemModstamp | SystemModstamp |
title | Title |
website | Website |
Questions? Contact us by email or on
Slack