Setting up Sitecore Connect for Salesforce and how to work with a Sandbox

When installing one of the various Sitecore Connect for Salesfoce connectors that can be found here:

https://dev.sitecore.net/Downloads/Salesforce_Connect.aspx

You may run into problems when moving through the various steps in the case that the Salesforce environment you are using is actually a Sandbox environment.

The various steps of the installation are actually pretty straight forward. they are described in much more detail in the specific installation guides but the information below gives you a good overview of the complexity and specific highlevel steps. And it adds just that little extra sauce in case you are using a sandbox environment:

- Install the correct DEF framework (2.0.1 and onwards)
- The 3 providers (Salesforce CRM, Sitecore and xConnect)
- Sitecore connect for Salesforce

Once these pre-requisites are set up, it is time to Convert the installed xConnect Model to JSON and deploy it onto the xConnect roles (xconnect server and indexing server)

Next, log into your Salesforce environment and create your Salesforce connected App. In case that you can't find your way around that environment (like me), switch into the Classic user interface. To do that, just click on your username (right top) and find the option underneath your user menu.

Next up is connecting your Sitecore environment with this Salesforce environment.
In order to do that you'll need 5 specific values to help you construct a specific connectionstring.
- User ID
- Password
- Security Token value
- Client consumer key
- Client consumer secret

The first two are pretty straightforward, the security token is coupled to your account and needs to be reset in order to retrieve it via your configured email address. And the two last ones are retrieved from the connected app that we just configured.

Doing all the above steps will lead you to something that should look like this:

<add name="mysf" connectionString="user id=someone@email.com;password=b;client
id=GEH9zlTNB8o8BA45pAeDtC8W.DIqrAzuzkmPwjz8KF_vzWY8dNIfurWHpfb
ZPGdtc3b;secret key=5468568999798354123;security

token=g3ygFuNzGgm33YTfsM3WKG3AA" />

Next steps is to set up a tenant and configure the endpoints.
However, that is where things started to go wrong for me.
In itself, the configuration of the Salesforce endpoint is nothing more defining the name of the connectionstring we just defined (in this case "mysf"). Once you finalize this you can test the setup by clicking "Run Troubleshooter".

In my case this resulted in:



So, what went wrong?
After some inspection into the log I noticed the following:


After looking around on the internet for a while and contemplating a possible logical cause, the only outcome could be the use of a Sandbox Salesforce environment instead of a standard environment.

It was time to dive into the DLL's and find out what call Sitecore was making exactly.
I found the following in the AuthenticationClientSettings class of the Sitecore.DataExchange.Providers.Salesforce.dll file.


So, even though that endpoint was hardcoded, there apparently was a flag built in that keeps the Sandbox setting in check. But no documentation is available on this flag or how to set it...

Next step, the SalesforceClientEndpointConverter class:



So, there we have it...
Plain and simple:

Adding "sandbox=true" in your connectionstring will resolve your problems...

Glad to see that this option was built in. However, having proper documentation on this might have helped :)

And of course, to prove it, let's press that button again:





Comments

Popular posts from this blog

Stupid exception: Device is not ready – System.IOException .net

Date Ranges in C#

Sitecore 8.2 in-depth preview + 8.3 update info and Sitecore Ecommerce information