Heroku Connect makes it easy for you to build Heroku apps that share data with your Salesforce deployment. Using bi-directional synchronization between Salesforce and Heroku Postgres, Heroku Connect unifies the data in your Postgres database with the contacts, accounts and other custom objects in the Salesforce database. Easily configured with a point and click UI, it’s simple to get the service up and running in minutes – no coding or complex configuration is required.
Login with your Salesforce Credentials
- Go to login/test.salesforce.com.
- Select Setup from the HomePage (In case if you couldn’t find it click on the name and then you will find the setup option).
- On the right side in the quick search box enter Object and click the objects.
- A list of existing objects appears. Then click on the new object and a window appears below.
- Enter the appropriate label name and the plural name. A Standard field can be created either data Type – Name or auto-number.
- At the bottom select the “Launch new custom wizard Tab after saving the custom object”.
- Click on next and choose a tab style for the object and save the object.
- After saving the object a detail page appears for the object created.
To create fields for that object
- Select NEW from the Custom fields & relationship.
Choose the required Data type and create the field by clicking next and save button.
Creating Salesforce Connected App
To create a connected app in Salesforce
- Setup→Create→ App→ Connected App→ new.
- Give a name to the app and the contact mail ID.
- Select “Enable OAuth settings” checkbox and give a setback URL.
- In Selected OAuth scopes choose “Full Access”.
Create an account in GitHub (https://github.com/), create a repository and select as a public repository
- Download the GitHub desktop app https://desktop.github.com/ and install the app and open when it’s done.
- Click on the cloned repository and add the URL of the repository you created (paste the HTTP link of the repository).
- The clone of the repository is created locally (Documents/GitHub/repository_name).
- Move the folders to the repository which are to be added to GitHub and once you paste the code you can see the files in the GitHub Application.
- Provide a valid message for the files to be uploaded.
Click commit to master and at the top you need to press the push button to commit to GitHub.
This is my Github URL:
Create an account in Heroku and create an app and open it.
Click on the resources tab and in the Add-ons input add both.
- Heroku Postgres
- Heroku Connect
Click on the Heroku Postgres , you will see the table size, number of rows in overView tab.
And select Heroku Postgres → settings, you can see the Database credentials .
Config Variables for adding Salesforce Org details
From App → Settings → Config variables→ Reveal config variables
Add the salesforce credentials like
- Consumer key
- Secret key
- Call back URL
- Database URI
- Org Id
Add NodeJs as a BuildPack
How to connect GitHub and Heroku
- App→ Deploy → Deployment Method
- Once you logged in to your Github account.
- Select the GitHub and give access then the select the search button and the list of repository appears then select what was created earlier.
- To automatically deploy the changes in the GitHub to Heroku database select “enable automatic deploys”
- In case if automatic deploy is not enabled to validate the code, then mannual deploy should be selected every time the code is changed or committed to GitHub. (For this we need CI automation.)
- Local repository → GitHub (push) → Heroku(automatic or manual deploy).
Open the NodeJs folder
- Open in sublime text→ server→ config → database.js
- Enter the Postgres database credentials in the Database.js file.
- Open in sublime text→ server→ config → routes.js
- For build your URL , accessing your postgres database and salesforce org.
Creating a table in your Postgres Database
- In command prompt type → NPM install PSQL
- In PC→ properties → Advanced system settings→ environment variables→ path → edit → add→ C:\Program Files\PostgreSQL\<version-number>\bin (in both user variables and system variables).
- Login with Heroku → Heroku login
- Enter login credentials (logged in as username message appears )
- Paste the Postgres Database URL .
You’re all set! Now you can use heroku and salesforce using NodeJs