https://github.com/mars/jsforce-patient-bulk-op
Patiently bulk insert/upsert to Salesforce via jsforce; adjustable timeout & poll frequency
https://github.com/mars/jsforce-patient-bulk-op
Last synced: 26 days ago
JSON representation
Patiently bulk insert/upsert to Salesforce via jsforce; adjustable timeout & poll frequency
- Host: GitHub
- URL: https://github.com/mars/jsforce-patient-bulk-op
- Owner: mars
- License: mit
- Created: 2016-07-13T22:47:47.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-15T18:15:11.000Z (about 10 years ago)
- Last Synced: 2026-05-16T09:34:00.120Z (2 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
jsforce-patient-bulk-op
==================
An npm module to [bulk insert/upsert to Salesforce via jsforce](https://jsforce.github.io/document/#bulk-api) with *patience*, adjustable timeout & poll frequency.
[](https://travis-ci.org/mars/jsforce-patient-bulk-op)
Usage
-----
```bash
npm install jsforce-patient-bulk-op --save
```
Begin with an authenticated jsforce connection. [jsforce-connection](https://github.com/mars/jsforce-connection) creates one based on the `SALESFORCE_URL` env variable, or directly use [jsforce's Connection](https://jsforce.github.io/document/#connection).
Returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) for the completed response of a [Bulk API](https://jsforce.github.io/document/#bulk-api) operation.
### Example
```javascript
const jsforceConnection = require('jsforce-connection');
const patientBulkOp = require('jsforce-patient-bulk-op');
return jsforceConnection()
.then( salesforceApi => {
return patientBulkOp(
salesforceApi, // A jsforce Connection
'Account', // Name of a custom or standard sObject
// Array of records to be inserted
[
{ Name: 'Zushi Co.' },
{ Name: 'MUJI' }
],
'insert', // Operation to perform
601000, // Timeout ms, 10-min default, just beyond Salesforce's
2000, // Poll Interval ms, 2-second default
console.log // A function to call with messages to log, default is no-op
)
.then( result => console.log(result) );
});
```