Installation
npm install sage-live --save
Overview
- Handles Authentication
- Allows Bulk Inserting, Upserting, Getting of all Salesforce objects that underpin Sage Live
- Returns Promises
The sage-live package is an easy way to deal with the revel API when using node.
var SageLive = ;var verbose = true;var endpoint = 'https://salesforce.com';var userName = 'kristo.mikkonen@fabacus.com';var password = 'PasswordHere';var securityToken = 'asdasdasdasdsad';var sageLive = endpoint userName password securityToken verbose;// Retrive objects by IDsageLive
If you want to interact with a different object, for example products with a resource URL of: "/resources/Product/" the function would be getProduct()
or if you want to access an order item at "/resources/OrderItem/" the function would be getOrderItem()
.
A full list of all the functions can be found at the bottom of this readme.
Example Usage:
var SageLive = ;var verbose = true;var endpoint = 'https://salesforce.com';var userName = 'kristo.mikkonen@fabacus.com';var password = 'PasswordHere';var securityToken = 'asdasdasdasdsad'; // optionalvar sageLive = endpoint userName password securityToken verbose;
Retrive and Delete by ID
// Retrieve the following 2 accountssageLive// Delete the following accountsageLive
Search
// Get multiple objects using search optionssalesforceObject = "Account";var searchOptions =CreatedDate:$gte: sageLivedatesortingOptions =CreatedDate: -1limit = 0;skip = 0sageLive
Bulk Insert
const itemsForBulkInsert =Name: 'Patrick McKinley'Name: 'Kristo Mikkonen'// Bulk insert into Account objectsageLive
Bulk Upsert
const itemsForBulkUpsert =Name: 'Patrick McKinley'Id: '0015800000RTkYH'Name: 'Kristo Mikkonen'Id: '0015800000RTkY2'const externalId =extIdField: 'Id'// Bulk upsert into Account object using the Id as the keysageLive