Integrate Salesforce with Heroku using Heroku Connect and Postgres

Share on facebook
Share on twitter
Share on linkedin
Heroku provides a cloud application platform to create, run, and work with your cloud based application. Thus, Heroku is termed as PaaS (Platform as a Service). Heroku supports several programming languages like JAVA, Node.js, Python, PHP, etc. The main reason for integrating Salesforce with Heroku is to provide a sophisticated custom user interface which we can develop using JAVA, Node.js, PHP, etc.

Heroku provides a cloud application platform to create, run, and work with your cloud based application. Thus, Heroku is termed as PaaS (Platform as a Service). Heroku supports several programming languages like JAVA, Node.js, Python, PHP, etc. The main reason for integrating Salesforce with Heroku is to provide a sophisticated custom user interface which we can develop using JAVA, Node.js, PHP, etc. It also supports replication of data from Salesforce using Heroku Postgres Database. There are many methods to integrate Heroku with Salesforce like Heroku Connect, Salesforce connect, Salesforce Rest API’s, Canvas Callouts, etc. In this article, we are going to see the integration part of the Heroku connect with Salesforce. Before diving into the integration part, let’s have an introduction of what Heroku Connect and Postgres is,

Heroku Connect –  It is an Add-on available in Heroku which supports us to integrate Salesforce and Heroku.

Heroku Postgres Database – It is the SQL database service which runs by Heroku and this is also available as Add-on in Heroku.

salesforce heroku

Let’s start to integrate Salesforce with Heroku.

Prerequisites

  1. Salesforce Developer Account
  2. Heroku Account
  3. Install pgAdmin (Download[Symbol]pgadmin4-1.1-x86.exe) in your local system.

Creating an Heroku Application

  1. Log into to your Heroku Account and click “Create New App”.
salesforce heroku

Provide your App Name and select Runtime (Your App can run in your choice of a region) for your application. Then, click “Create App”.

salesforce heroku

Heroku Add-ons

2. Go to the menu at the top and click on “Resources”.

salesforce heroku Connect

Under Add-ons, type “Heroku Connect” [Symbol] select the “Heroku Connect” Add-on [Symbol] Select the plan name as “Demo Edition – Free” and then click provision to add Heroku connect in your application. We can also have other add-ons available in Heroku and use them based on our needs.

Here, I used free edition for my application. Paid version is also available depending upon the user requirements.

salesforce heroku Connect

Again Click on “Resources” [Symbol] Type “Heroku Postgres” in the Add-ons [Symbol] Select a plan name as “Hobby Dev – Free”  and then click provision.

Now, you have added both Heroku Connect and Heroku Postgres database in your application.

Integrate Salesforce with Heroku

You have the required add-ons for the integration and now it’s time to get connect your Salesforce account with your heroku application.

3. From your Heroku application, select Resources [Symbol] Heroku Connect add-ons [Symbol] click Setup Connection. Enter Schema name and then click next.

salesforce heroku Connect

Enter your Environment as production (Salesforce developer account is available under production option), and select your API Version and click Authorize.

salesforce heroku Connect

It will redirect you to the Salesforce login page. Provide your Salesforce username and password and then click login. Now, your Salesforce account will get connected with Heroku.

Create Mapping

4. You can map the Salesforce object of your choice with Heroku.

From your Heroku app, select Resources [Symbol] Heroku Connect add-ons [Symbol] Create Mapping.

Select the object you want to map, and then select the fields to sync with your application.

The required fields are get selected by default. You are not allowed to unselect them.

For example, map your Account object from Salesforce to Heroku and check AccountId & AccountNumber fields to sync with your Heroku account.

salesforce heroku Connect

Check “Listen for updates using streaming API” and check “write to salesforce any update to your database”. Select upsert field of your choice (when writing data to Salesforce, this field maps the external Id).

salesforce heroku Connect

Data which are associated with the salesforce object will get synchronized with the Heroku application. It frequently polls and sync data from Salesforce.  You can view the Salesforce data by clicking “Explorer” from the menu at the top. Extend the Salesforce record and click “Data” to view your salesforce record detail.

salesforce heroku Connect

Extend a record and click “Data” to view the salesforce record.

salesforce heroku Connect
salesforce heroku Connect

Access Heroku Database using pgAdmin

5. You can access your Heroku database on the local system by using pgAdmin. Download and install pgadmin4-1.1-x86.exe from the following link.

https://www.postgresql.org/ftp/pgadmin3/pgadmin4/v1.1/windows/

Open pgAdmin on your system and right click on the server [Symbol] create [Symbol] server.

salesforce heroku Connect

In general tab, enter Name, Server group, and check “connect now”.

salesforce heroku Connect

In connection tab, Provide your Heroku database details. From your Heroku application, select Resources [Symbol] Heroku Postgres Add-ons [Symbol] click View credentials near database credentials.

salesforce heroku Connect
salesforce heroku Connect

Copy & paste all the required database details from Heroku to pgAdmin Server connection, and click save.

heroku salesforce integration

You can find your database by clicking “Server”. It shows the entire database from Heroku and there you can find your database for which you have provided access.

heroku salesforce integration
heroku salesforce integration

Extend your database by clicking on the plus symbol at the right, extend schemas, extend salesforce[Symbol]extend Tables [Symbol] select your object. Right click on the object; select View Data[Symbol] View All Rows. You can see all your Salesforce data rows in pgAdmin.

heroku salesforce integration

You can also insert, update and delete record into your Heroku database using pgAdmin. These changes will automatically get sync with your Salesforce org.

Extend your database by clicking on the plus symbol at the right, extend schemas, extend salesforce[Symbol]extend Tables [Symbol] select your object [Symbol]Right click on the object [Symbol] select Query Tool. Write the database command as you need and execute it. It will sync with your Salesforce data. For example, if I need to insert account into Heroku database using command “Insert into Salesforce.account (name) values (“Heroku Connect Account”)”

heroku salesforce integration

You can view the number of records sent from Heroku to Salesforce in Heroku connect.

heroku salesforce integration

Limitations of Heroku Free Account:

Heroku provides both paid and unpaid version for the user, and it depends on how you need Heroku application. Heroku free account allows you to create a maximum of 5 application. Heroku Postgres “Hobby Dev – Free” provide 20 connection, 10,000 rows and 7.5 MB of data size at free of cost. If you want more features, pay and use the Heroku application and Add-ons as well.

Conclusion

Thus, the Heroku Connect with its easy configurations and easy access of add-ons provision with the click of a button make data sync between a Salesforce object and Heroku Postgres table much easier.

About MST

At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.

Recent Articles

Mobile Responsive Testing

Mobile Responsive Testing is simply a Testing Process performed to make sure that your website or an app is working appropriately on all types of devices.
Whether it an app or website, they need to ensure that they are accessible from any device, anytime, anywhere.

Read Article »

Work with us.

Our people aren’t just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.