Time to integrate Salesforce with Sitecore

While integrating Salesforce into Sitecore once again for a client, I noted some differences between using SOAP and REST API for Salesforce. This is a set of notes meant to show a comparison between the two API options for Salesforce.  At the bottom, there is a section on the Sitecore third party connection option as well.

By the way, SFDC = Salesforce dot com

Summary

REST NuGet option is nice because it builds separate class files and you only select the objects that you need (like Lead, for instance).  Also, it provides property attributes like string length.

However, with REST, the connection errors tend to be vague and it is recommended that you have admin privileges in Salesforce to see the login history.

login-history

 REST (DeveloperForce.Force NuGet)  SOAP
Service type  NuGet package option:
connected-service
nuget-package
soap-service-ref (WSDL)
Salesforce objects Setup wizard lets you select which objects to define in your project;

Classes are auto-generated into separate files with helpful attributes like:
attributes

 Partial classes auto-generated to
single, large Reference.cs file
Salesforce methods  Within assemblies provided by the NuGet package:
assemblies-nuget
service
Ability to switch
between sandbox and prod
credentials
Provided helper class will read credentials from env’s appSettings.config (or customize to read from
SiteApplicationSettings.config)
 There are probably a few ways to do this.

Modify/add the service class constructor(s) in Reference.cs
with a conditional to determine the correct SFDC url or read from appSettings.config

Async  Built in to this NuGet pkg Available
Troubleshooting Will give a 400 Bad Request for a variety of reasons.
Examples:

  • not having the correct security protocol:
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
  • not using Content-type = application/x-www-form-urlencoded (nuget package provides this)
  • invalid username, password+securitytoken, consumerkey, consumersecret
     

Ensure that you have some admin rights in Salesforce to see the Login History.

 Gives a decent error message like:
INVALID_LOGIN: Invalid username, password,
security token, user not active, or user locked out
New fields added to SFDC? Create a new connected app … (which generates classes again)

(You’ll get new ConsumerKey and ConsumerSecret values)

 get updated WSDL
Regenerate Reference.cs
Assistance: REST blog post
between sandbox and prod
credentials
 Salesforce SOAP guide

The money option – 3rd party connector

If you are doing a Salesforce integration that involves heavy traffic to SFDC or bulk inserts/updates, you may want to consider another option … a third party connector.  To my knowledge, there is only one out there:  S4S at fuseit.com.

In addition to its Data Connector, which captures data from Sitecore web site and serializes it to SFDC, S4S has three auxiliary ones:

1. DMS Connector – Transfer information in Analytics to SFDC

2. Reports Connector – View SFDC reports from Sitecore

3. Security Connector – Becomes a data source for a custom membership provider in Sitecore 

Advertisements