by lacroi987

GitHub Readme.md


Just a node.js + react CRUD app to demo Heroku connect. It is set up to sync the Account object down. It relies on a field called external_id__c as it's external ID for upserts. The rails app will do the "right thing" and automatically generate a guid for any records created there.


Get a trial force org. If you do not have an external id field called external_id__c you will need to create one in your org. You need to insure that it's a text field and it's set up as an external id.

Click on this button:


Or, deploy the app by hand:

git clone https://github.com/sshaginyan/HCNodeDemo
cd HCNodeDemo
heroku create
heroku addons:create herokuconnect:demo
heroku addons:create heroku-postgresql:hobby-dev
git push heroku master

Now Launch https://dashboard.heroku.com/ and locate your newly created app.

Click on Heroku Connect under Add-Ons

Once you launch Heroku connect, you will be asked to create a new schema and connection to your salesforce org.

Map the following fields over in Heroku Connect, or just import the hcnodedemo.json file to load the configuration:

  • accountnumber
  • accountsource
  • billingcity
  • billingcountry
  • billinglatitude
  • billingpostalcode
  • billingstate
  • billingstreet
  • description
  • external_id__c
  • fax
  • name
  • phone
  • recordtypeid
  • tickersymbol
  • website

You will also need to point the External ID for upserts in Connect to external_id__c.

After your first sync, your Postgres table should look like this (use \d salesforce.account in heroku pg:psql to view it)

hcrails-dev::DATABASE=> \d salesforce.account
                                            Table "salesforce.account"
      Column       |            Type             |                            Modifiers                            
 lastmodifieddate  | timestamp without time zone | 
 billingstreet     | character varying(255)      | 
 website           | character varying(255)      | 
 createddate       | timestamp without time zone | 
 billingpostalcode | character varying(20)       | 
 _hc_lastop        | character varying(32)       | 
 name              | character varying(255)      | 
 billinglongitude  | double precision            | 
 billingcountry    | character varying(80)       | 
 description       | text                        | 
 external_id__c    | character varying(128)      | 
 _hc_err           | text                        | 
 accountsource     | character varying(40)       | 
 phone             | character varying(40)       | 
 billinglatitude   | double precision            | 
 isdeleted         | boolean                     | 
 billingcity       | character varying(40)       | 
 id                | integer                     | not null default nextval('salesforce.account_id_seq'::regclass)
 fax               | character varying(40)       | 
 billingstate      | character varying(80)       | 
 sfid              | character varying(18)       | 
    "account_pkey" PRIMARY KEY, btree (id)
    "hcu_idx_account_external_id__c" UNIQUE, btree (external_id__c)
    "hcu_idx_account_sfid" UNIQUE, btree (sfid)
    "hc_idx_account_lastmodifieddate" btree (lastmodifieddate)
    hc_account_logtrigger AFTER INSERT OR DELETE OR UPDATE ON salesforce.account FOR EACH ROW WHEN (get_xmlbinary()::text = 'base64'::text) EXECUTE PROCEDURE salesforce.hc_account_logger()
    hc_account_status_trigger BEFORE INSERT OR UPDATE ON salesforce.account FOR EACH ROW EXECUTE PROCEDURE salesforce.hc_account_status()

Launch the app

heroku open