Heroku to Salesforce using NodeJs

By in
Heroku to Salesforce using NodeJs

Salesforce

Login with your salesforce Credentials

  1. login/test.salesforce.com.
  2. Select Setup from the homePage (Incase if you couldn’t find it click on the name and the you will find the setup option).
  3. In the right side in the quick search box enter Object and click the objects.
  4. list of existing object appears and then click on the new object and a window appears as below.
  5. Enter the appropriate label name and the plural name. A Standard field can be created either data Type – Name or auto-number.
  6. At the bottom select the “Launch new custom wizard Tab after saving the custom object”.
  7. click on next and choose a tab style for the object and save the object.
  8. After saving the object a detail page appears for the object created.

To create fields for that object

  1. 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

  1. Setup→Create→ App→ connected App→ new.
  2. Give a name to the app and the contact mail ID.
  3. Select “Enable OAuth settings” checkBox and give a setBack URL.
  4. In Selected OAuth scopes choose “full Access”.

GitHub

Create a account in GitHub (https://github.com/) and create a repository and select as a public repository

  1. Download the GitHub desktop app https://desktop.github.com/  and install the app and open when it’s done.
  2. Click on the clone repository and add the URL of the repository you created (paste the HTTP link of the repository).
  3. Clone of the repository is created locally (Documents/GitHub/repository_name).
  4. 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.
  5. 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:

https://github.com/vignesh-pashtek/nodeRESTApiRequest

Heroku

Create a account in Heroku and create a app and open it.

Click on the resources tab and in the Add-ons input  add both.

  1. Heroku postgres
  2. 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

  1. Consumer key
  2. Secret key
  3. Call back URL
  4. Database URI
  5. Org Id
  6. password+securityToken

BuildPacks

Add NodeJs as a buildPack

How to connect GitHub and Heroku

  1. App→ Deploy → deployment method
  2. Once you logged in to your github account.
  3. Select the GitHub and give access then the select the search button and the list of repository appears and select which was created earlier.
  4. To automatically deploy the changes in the GitHub to heroku database select “enable automatic deploys”
  5. 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.)
  6. Local repository → GitHub (push) → heroku(automatic or manual deploy).

Open the NodeJs folder  

  1. Open in sublime text→ server→ config → database.js
  2. Enter the postgres database credentials in the Database.js file.
  3. Open in sublime text→ server→ config → routes.js
  4. For build your URL , accessing your postgres database and salesforce org.

Creating a table in your postgres database

  1. In command prompt type → npm install psql
  2. 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).
  3. Login with heroku → heroku login
  4. Enter login credentials (logged in  as username message appears )
  5. Paste the Postgres Database URL  
Leave a reply

Your email address will not be published. Required fields are marked *