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.
Let’s start to integrate Salesforce with Heroku.
- Salesforce Developer Account
- Heroku Account
- Install pgAdmin (Download[Symbol]pgadmin4-1.1-x86.exe) in your local system.
Creating an Heroku Application
- Log into to your Heroku Account and click “Create New App”.
Provide your App Name and select Runtime (Your App can run in your choice of a region) for your application. Then, click “Create App”.
2. Go to the menu at the top and click on “Resources”.
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.
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.
Enter your Environment as production (Salesforce developer account is available under production option), and select your API Version and click Authorize.
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.
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.
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).
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.
Extend a record and click “Data” to view the salesforce record.