Salesforce as a Data Source

Salesforce AppExchange. Source

Salesforce is the most popular Customer Relationship Management (CRM) tool in the world, with 19.5% of the market share of CRM solutions in 2018. CRM platforms offer a centralized system to deal with company and customer relationships, including potential customers. Salesforce solutions encompass customer service, marketing, sales, digital commerce, and more. 

Salesforce is a powerful ecosystem that brings together all the capabilities any marketing, sales, or customer service team may require on the daily. What makes Salesforce even more powerful is its flexibility and extendability. Besides its comprehensive marketplace of apps that Salesforce can be integrated with, called AppExchange, Salesforce provides secure and extensive products and APIs to integrate with any service that you might need.

One such widely used service is the Platform-as-a-Service (PaaS) offering Heroku. As a leading cloud application platform, Heroku takes away the complexity of running, deploying and managing applications, allowing your team to focus on developing the integral parts. Heroku provides the shortest path from idea to working application, whether you are developing a prototype or a business-critical feature. Being a Salesforce company, Heroku integrates seamlessly with Salesforce.

Connecting Salesforce with customer-facing Heroku applications. Source

In what scenarios would you want to integrate Heroku with Salesforce?

One of the main reasons is using Salesforce as a data source, and using Heroku as a means of building applications leveraging Salesforce data. Product data, customer data, or analytical insights gained from Salesforce can be integrated into customer-facing applications. Using Salesforce as a data source, you can build low-latency, high-throughput applications on Heroku to serve your customers. For example, imagine that you are running a second-hand book store online. The records of the books that you’re selling, along with customer information are stored in Salesforce, while the web application is served with Heroku. Your customer-facing Heroku web platform can leverage product and customer records from Salesforce, while also registering customer actions back into Salesforce for further analysis by marketing and sales teams. 

Source: Heroku Connect (

How can you do this as a Salesforce user? The answer lies in Heroku Connect. This service offers uni- or bi-directional synchronization between Salesforce and Heroku Postgres, Heroku’s managed SQL Database-as-a-Service (DBaaS) offering. Utilizing data from Salesforce becomes as easy as querying your Heroku Postgres using simple SQL. Since Heroku Postgres is physically closer to your Heroku application, querying is faster and latency is lower. Using an out-of-the-box solution like Heroku Connect removes the need to manually sync data between your CRM system and your customer interface, saving precious developer time.

The process of connecting Salesforce and Heroku Postgres via Heroku Connect is highly customizable: 

  • You can select which fields from which entities you want to be synced to your Heroku Postgres table. 
  • You can control whether syncing is uni- or bi-directional, on a field level. Some field mappings can be marked as read-only, while some can be marked as read-write for bi-directional synchronization.
  • You can further decide synchronization intervals. Heroku Postgres can poll Salesforce in as low as 2 minute intervals, or you can configure accelerated polling to track and respond to changes in Salesforce data.

Heroku Connect dashboard overview. Source

In certain situations, you might not want to synchronize or replicate data in Salesforce with Heroku. Instead, you might just want to use data that is stored in a Heroku data source within Salesforce, without syncing. There can be multiple such situations: the data can be large and expensive to replicate, you might only want access to a small portion of the data with each query, or you might simply want real-time access to the latest version of the data source without having to deal with eventual consistency. Imagine that you have a monitoring platform to track customer behavior on your website, and each customer action is stored in a Heroku Postgres database. While certain customer tendencies might be valuable to be extracted, not all actions on a low level of granularity need to be copied to your Salesforce org. 

In such a case, Salesforce Connect is your savior. Salesforce Connect enables you to integrate external data sources into your Salesforce org, allowing read, search, lookup and even write operations within Salesforce — just as you would with internal data. With Salesforce Connect, you can utilize external data from sources like SAP NetWeaver Gateway, Microsoft Dynamics NAV, or Heroku Postgres.

To use Salesforce Connect with Heroku, you use Heroku External Objects to wrap your data in Heroku Postgres in an OData format, and voila — your Heroku Postgres database is available by reference in your Salesforce org! Again, this process is highly customizable:

  • You can select which tables and/or views will be exposed to Salesforce.
  • You can choose whether you want writable external objects, i.e. whether you want to allow Salesforce to write records back into your Heroku Postgres.

Another scenario where you might want to integrate Heroku with Salesforce is to offload compute or data intensive tasks, or external processes such as trigger handling to Heroku apps. An example from Salesforce’s documentation is perfectly illustrative: imagine you have a platform for rental rooms. To cut costs on storage and reduce loading times, and for uniformity, you can resize or edit images that the users upload to your platform through an application that runs on Heroku and that is triggered whenever a user uploads an image. In a similar vein, the batch offloading jobs can include custom artificial intelligence applications running on Heroku, since training and serving such applications can be compute intensive. 

Integrating Heroku with Salesforce is as easy as it gets. Heroku is a Salesforce company, so using the two powerful systems together is designed to give the most accessible user experience. As I said before, it’s not just Heroku that can be integrated with Salesforce – through the marketplace AppExchange, via tools like Salesforce Connect, and numerous APIs, you can integrate many services and platforms with Salesforce. For more information on how to connect Heroku and Salesforce, you can check the related Salesforce documentation and Heroku Connect documentation


Gokhan Simsek

Eindhoven, The Netherlands

Gokhan is a computer science graduate, currently pursuing a MSc. degree in Data Science at Eindhoven University of Technology. He’s interested in big data, NLP, and machine learning.

Software Weekly

Software Weekly

Subscribe to Software Weekly, a curated weekly newsletter featuring the best and newest from the software engineering community.