Write a Heroku Scheduler batch for MangoDB+Salesforce with Node.js
- Oct
- 28
- Posted by Lin
- Posted in Heroku, Node.js, Open Source, Other, REST API, Salesforce
In previous post,I had shared how to 《Access Salesforce data via APIs(JSForce) from Outside Service》.
In this post I will share about how to write a Heroku Scheduler batch for synchronizing MangoDB data to Salesforce with Node.js, like the below outline picture.
※I have no doubt that there have many ways to do connect between MangoDB and Salesforce, such as 《 Lightning Connect Custom Adapters and MongoDB》By Enrico Murru and 《 Powering Salesforce Lightning Connect with MongoDB》, and I will try and share that in next posts separately.
Here we go.
Enjoy it.
In this post I will share about how to write a Heroku Scheduler batch for synchronizing MangoDB data to Salesforce with Node.js, like the below outline picture.
※I have no doubt that there have many ways to do connect between MangoDB and Salesforce, such as 《 Lightning Connect Custom Adapters and MongoDB》By Enrico Murru and 《 Powering Salesforce Lightning Connect with MongoDB》, and I will try and share that in next posts separately.
Here we go.
1. In Salesforce
The Data Model
New a custom object named “MangodbObject” for storing MangoDB data.2. In Cloud9 IDE
Update package.json
Add “async“, “moment“ and “mongoose“ to package.json file.Create batch files
Create “db.js” and “sfdc.js” in root directory with the blow source code.Depoly to Heroku
Depoly changed files to Heroku as the previous post,《Awesome Node.js development environment with Heroku and Cloud9》3. In Heroku
Add Add-ons
Add “MangoLab“ and “Heroku Scheduler“ to Heroku.Prepare test data of MongoDB
Create a collection named “accounts” and add the following data in MongoLab.Add new job in Heroku Scheduler
4. Results
Heroku logs
Check Heroku logs with Heroku command “heroku logs”.Data in Salesforce
Now we have a batch which synchronizes data everyday from MangoLab to Salesforce. ;)Enjoy it.
Recent Posts
- Salesforce DevTools Release Notes (version 3.10.0) – mass edit custom fields on lightning
- Salesforce DevTools Release Notes (version 3.9.0) – Object Fields, SOQL Query Editor
- Salesforce DevTools Release Notes (version 3.8.0)
- Salesforce DevTools JUST HIT 10,000 USERS! THANK YOU!
- Using Promise for Apex Server-Side request in Lightning Component
Top Posts
- Salesforce DevTools – Powerful Salesforce developer tools, loved by over 50K developers - 219.6K views
- Date format and DateTime format - 204K views
- Salesforce Mass Editor (Chrome Extension) – Mass create, mass update, mass clone, mass delete on any list view. Support for both Classic and Lightning! - 158.4K views
- Setup an awesome Salesforce developer environment with Sublime Text 3 - 122.3K views
- Writing a Schedulable Batch Apex in Salesforce - 118.8K views
Categories
- APEX
- Apps
- Custom Label
- Custom Metadata
- Custom Setting
- Design & UI
- Event
- Heroku
- iOS & Object-c
- Lightnint Component
- Linux & Mac OS
- Metadata API
- Node.js
- Open Source
- Other
- PHP Framework
- Release Notes
- REST API
- Salesforce
- Salesforce DevTools
- Salesforce DX
- SOQL
- Tooling API
- Unit Tests
- Validation Rule
- Visualforce
- WordPress
You must be logged in to post a comment.