web analytics
Press "Enter" to skip to content

Integrating and Syncing Salesforce with Sql Server

Lars Fiedler

When it comes to CRMs these days, Salesforce has maintained its industry leadership for quite some time.  But its analytics and reporting capabilities surrounding the data it controls has always been a bit lacking.  For creating cross cutting reports and integrating data in Sql Server, you’ve got a few options.  One option is to bring Sql Server data into Salesforce, and then use their native reporting capabilities.  Another option is to run reports and SOQL queries in Salesforce, and dump out of the data while temporarily enriching it with Sql Server data.  The latter is typically the norm, and is automated with Composable.

But what if you need to do massive and complicated joins with your Salesforce data and with existing Sql Server databases?

How can you easily get your leads, contacts, accounts, and custom objects out of Salesforce and into your other databases?

Say Hello to a few Dataflows in Composable.

With Composable, you can automate the generation of SQL tables to store Salesforce data.  And once these tables are created, you can then use Composable to automate the querying and insertion of the data.

For automating the generation of the SQL tables,  we’ll be using 2 features in Composable (Forms and Dataflows).   We’ll use a Dataflow to automatically generate a Form in Composable.  And then the generated Form is used to store each Salesforce Object as a Form Container.  A Composable Form is backed by an auto-generated Sql Server database.

The Salesforce Describe module is used in a Dataflow to find all the meta information about a particular Salesforce Object.  This metadata is then piped into a code module, which maps all the field attributes to a Form container (see code below).

Create Salesforce Form

Now that we have the tables created in Sql Server, we can use another Dataflow to query Salesforce objects and insert the data into the tables.

A few interesting tidbits:

  • Deleted objects are also included in the Salesforce results.  There will be an IsDeleted column in the Sql table.  Deletes will essentially act as updates (IsDeleted = true).
  • It is not guaranteed that all values in a Salesforce field will have a length <= the length specified in the fields metadata.  Why is this you ask?  It is possible that the length is updated (shortened) after data has been inserted.  Salesforce will not retroactively truncate the field.  It will only truncate it on future updates.  So when using the length as your max length in Sql Server, you may have to allow for truncation, or increase the size of the columns.

Import Salesforce

Lars Fiedler

Lars has comprehensive expertise building large complex software systems, and has served as a Software Engineer at MIT’s Lincoln Laboratory since 2010, where he began developing Composable Analytics. Prior to joining Lincoln Laboratory, Lars worked as a Software Engineer at Microsoft Corporation from 2006 to 2010. Lars received his MS in Computer Science from Georgia Institute of Technology in 2004, and his BS in Computer Science from Georgia Tech in 2003.