You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-13Lines changed: 12 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,5 @@
1
1
# Heroku Integration - Salesforce API Access (Node.js)
2
2
3
-
> **Important**: For use with the Heroku Integration and Heroku Eventing pilots only
4
-
5
3
## Architecture Overview
6
4
7
5
This sample application showcases how to extend a Heroku web application by integrating it with Salesforce APIs, enabling seamless data exchange and automation across multiple connected Salesforce orgs. It also includes a demonstration of the Salesforce Bulk API, which is optimized for handling large data volumes efficiently.
@@ -13,20 +11,20 @@ This sample application showcases how to extend a Heroku web application by inte
13
11
* Heroku login
14
12
* Heroku AppLink Pilot enabled
15
13
* Heroku CLI installed
16
-
* Heroku AppLink Pilot CLI plugin is installed
14
+
* Heroku AppLink CLI plugin is installed
17
15
* Salesforce CLI installed
18
16
* Login information for one or more Scratch, Development or Sandbox orgs
19
-
- Watch the [Introduction to the Heroku AppLink Pilot for Developers](https://www.youtube.com/watch?v=T5kOGNuTCLE) video
20
17
21
18
## Local Development and Testing
22
19
23
20
You do not need to deploy your application but you do need to configure it with Heroku.
@@ -36,15 +34,15 @@ Navigate to `http://localhost:5006` to observe a list of accounts from the conne
36
34
37
35
### Multiple Org Connections
38
36
39
-
To access multiple Salesforce orgs, repeat the `salesforce:connect` command above with different org logins and connection names, then update the `CONNECTION_NAMES` environment variable within the `.env` file with a comma delimiated list of connection names (example shown below). The sample code will automatically query for `Account` in each org and display the results.
37
+
To access multiple Salesforce orgs, repeat the `salesforce:authorizations` command above with different org logins and connection names, then update the `CONNECTION_NAMES` environment variable within the `.env` file with a comma delimiated list of connection names (example shown below). The sample code will automatically query for `Account` in each org and display the results.
40
38
41
39
```
42
40
CONNECTION_NAMES=my-org,my-org-sales-a
43
41
```
44
42
45
43
### Bulk API Demo
46
44
47
-
This sample includes a demonstration of using the Salesforce Bulk API using connections formed with the Heroku Integration add-on. To see this in action obtain an org that is empty or that you are using for testing purposes only. Repeat the `salesforce:connect` command above using the connection name `empty-org` and then update the `CONNECTION_NAMES` environment variable within `.env` with a comma delimiated list of connection names (example shown above).
45
+
This sample includes a demonstration of using the Salesforce Bulk API using connections formed with the Heroku Integration add-on. To see this in action obtain an org that is empty or that you are using for testing purposes only. Repeat the `salesforce:authorizations` command above using the connection name `empty-org` and then update the `CONNECTION_NAMES` environment variable within `.env` with a comma delimiated list of connection names (example shown above).
48
46
49
47
When you visit the `/bulk-demo` endpoint, the application will check for existing bulk-loaded records. If none are found, it will start an asynchronous bulk load process. You will see output in the console similar to this:
50
48
@@ -83,20 +81,21 @@ echo "delete [SELECT Id FROM Account WHERE Name LIKE 'Bulk Account%'];" | sf ape
To access multiple Salesforce orgs, repeat the `salesforce:connect` command above with different org logins and connection names, then update the `CONNECTION_NAMES` with a comma delimiated list of connection names. The sample code will automatically query for `Account` in each org and display the results.
92
+
To access multiple Salesforce orgs, repeat the `salesforce:authorizations` command above with different org logins and connection names, then update the `CONNECTION_NAMES` with a comma delimiated list of connection names. The sample code will automatically query for `Account` in each org and display the results.
94
93
95
94
## Technical Information
96
95
97
-
* Salesforce APIs are always accessed in the context of the authenticated user defined at the time of connection through the `--store-as-run-as-user` CLI parameter. This means that only the objects and fields the user has access to can be accessed by the code.
96
+
* Salesforce APIs are always accessed in the context of the authenticated user. This means that only the objects and fields the user has access to can be accessed by the code.
98
97
* This is a Node.js Express application, using EJS to render browser content. Other client libraries and frameworks can be used of course.
99
-
* The application uses the `@heroku/salesforce-sdk-nodejs` package to handle Salesforce connections, authentication, and API interactions including SOQL queries and Bulk API operations.
98
+
* The application uses the `@heroku/applink` package to handle Salesforce connections, authentication, and API interactions including SOQL queries and Bulk API operations.
100
99
* The sample uses a custom environment variable `CONNECTION_NAMES` to enumerate the org connections to be used by the application. However this could easily be hardcoded in your own library code, or obtained from a configuration service or other preferred means of your choice.
101
100
* The Bulk API demo intentionally showcases real-world duplicate handling scenarios. Some records may fail to insert due to Salesforce duplicate detection rules, which demonstrates proper error handling in bulk operations. Users can either accept this as a learning opportunity about integration resilience or temporarily disable duplicate rules in their Salesforce org for testing purposes. Successfully inserted records will still be visible on the main page, regardless of any duplicate-related failures.
0 commit comments