This blog will provide a high-level overview of how I used Heroku Connect to bring data to a Heroku app built with Lightning Web Component Open Source. I will go over the definition, the setup, configurations, and the result.
Heroku Connect
Heroku Connect is an add-on that synchronizes data between your Salesforce organization and a Heroku Postgres database. Using Heroku Connect with Heroku Postgres, you can build custom applications that interact with your Salesforce data.
Setup
I created a simple app to showcase a list of puppies available for sale. I used Lightning Web Components Open Source and Salesforce Design System. I set up a simple Express server, connected postgres using URI, and used node-postgres to query the database. The app was deployed to Heroku.
In Salesforce, I created a custom object to store information about the puppies such as age, name, and breed.
Configuration
I logged in to the Heroku dashboard, navigated to resources, and selected two add-ons: Heroku connect and Heroku Postgres to use as a database.
Next, I mapped my custom objects and necessary fields.
Then restarted the app to apply the changes.
Result
After following all steps listed above, I was able to view the Salesforce data in my app.
I logged in to Salesforce, updated the second puppy's name from Berlin to Rio.
After the change, I opened the Heroku app and the name change was reflected.
Conclusion
By utilizing Heroku connect, I was able to replica my Salesforce data and display it on a public website for all users to see. While the use case that I explored only needed one-way communication, Heroku connect also has bidirectional data replication. This is useful in cases where users need to create or update information stored in Salesforce. To learn more and view limitations, refer to the documentation Heroku.
Top comments (0)