How to insert data into Heroku Postgres table from Visual Studio Code and write back to Salesforce?

How to insert data into Heroku Postgres table from Visual Studio Code and write back to Salesforce?

To connect Heroku Postgres from Visual Studio Code, check the below link.

To insert data into Heroku Postgres table from Visual Studio Code and write back to Salesforce, follow the below steps:

1. Enable  “Write database updates to Salesforce using” from the Object Mapping.

2. Sample Codes:

1. Inserting into case table with Subject, Origin and Priority.

INSERT INTO salesforce.case( subject, origin, priority )
VALUES ( 'test from Heroku', 'Web', 'High' );

2. Inserting into case table with Subject, Origin, Priority and OwnerId.

INSERT INTO salesforce.case( subject, origin, priority, ownerid )
VALUES ( 'test from Heroku1', 'Web', 'High', '0054x000003WYaSAAW' )
RETURNING id;

3. Check the data in Salesforce.

Leave a Reply