The Startup
Published in

The Startup

What is the best practice for synchronizing data between a Ruby on Rails app and Salesforce?

ne of the most crucial elements of a successful business structure is a strong sales department, regardless of the size of the business. The Salesforce software platform, a leading customer relationship management (CRM) tool is what most companies today base their sales processes around to ensure they maintain a high level of CRM productivity within their sales teams. Now before we get to the synchronization part let’s look at integration.

What to keep in mind:

  • The major mistake most companies make, when it comes to Salesforce integration is presuming the data passed between both the systems is consistent and present. Now when somebody adds a new account in Salesforce, without filling out the external identifier field, the problem arises. Another issue is when a person does not fill out the corresponding identifier field, present in System A. Both of these can lead to synchronization failures between both the systems. Further, the identifier in a certain system might allow certain special size or character restrictions the second system doesn’t, and this too might lead to some problems.
  • If you’re undertaking a Salesforce integration, before importing the data into Salesforce, take the time out to clean it up. Merge accounts whenever possible to avoid duplicate contacts and accounts. Then import a small test of about five to ten records when you have your data organized into a spreadsheet. Now login to Salesforce and double-check to ensure all the fields are mapped to the right location. If the import doesn’t go as envisioned, you’ll only have to delete a handful of records rather than the potentially thousands.

Synchronizing data

Ruby on Rails, being a fine web development framework and Salesforce, on the other hand, a large CRM tool, might seem like an unlikely pair. What when you think of Rails, as the elegant, lean and designed especially for making the process of web development smoother, while Salesforce is a large, often confusing tool meant for handling lots of different jobs. They actually work exceptionally well together, although they are dramatically different.

A connection adapter of Rails to data managed by Salesforce, Active Salesforce, allows you to work with this unlikely pair. This RubyGem transforms working with Salesforce data to something as smooth as the Rails-MySQL pair. Now you have to synchronize any local MySQL database with the Salesforce when working on a Rails-Salesforce application. This is necessary since several parts of the application are time-sensitive, and the connection with Salesforce is not as fast as while working with a local database.

Now to design the application to synchronize data between the local database and Salesforce, first abstract behaviors to a SalesforceRecord class, that are specific to Salesforce classes. Then, abstract behaviors to an Acts::As::Syncable module, for local representations of the Salesforce classes. Use metaprogramming to add this module’s functionality to your local classes. Finally, add a method to send local updates to Salesforce. Then update both the Salesforce and local database. Now you can update and synchronize from your local database to Salesforce by adding just one line of code to your cloned Salesforce ActiveRecord classes.

A ruby on rails development company

This story is published in The Startup, Medium’s largest entrepreneurship publication followed by 292,582+ people.

Subscribe to receive our top stories here.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Amit Ashwini

See every interaction with a customer — across all digital channels — & quickly determine how to delight your audience with personalization and recommendations.