Created
March 29, 2016 05:20
-
-
Save tyoshikawa1106/3531d331d995fe69bbbc to your computer and use it in GitHub Desktop.
JSforce Bulk API Sample Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| batch.on("response", function(rets) { // fired when batch finished and result retrieved | |
| console.log('response'); | |
| console.log(rets); | |
| for (var i=0; i < rets.length; i++) { | |
| if (rets[i].success) { | |
| console.log("#" + (i+1) + " loaded successfully, id = " + rets[i].id); | |
| } else { | |
| console.log("#" + (i+1) + " error occurred, message = " + rets[i].errors.join(', ')); | |
| } | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| conn.bulk.load("Account", "insert", accounts, function(err, rets) { | |
| console.log('load'); | |
| console.log(rets); | |
| if (err) { return console.error(err); } | |
| for (var i=0; i < rets.length; i++) { | |
| if (rets[i].success) { | |
| console.log("#" + (i+1) + " loaded successfully, id = " + rets[i].id); | |
| } else { | |
| console.log("#" + (i+1) + " error occurred, message = " + rets[i].errors.join(', ')); | |
| } | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment