Create a new DataSource.
Config for this SDK.
Private singleton instance of this SDK. There should always be only 1 instance.
getter method for namespace. Provides the salesforce org namespace
setter method for namespace. Set custom namespace
Create a new ApexRemote wrapper
Create a new ApexRest wrapper
Create a new dataRaptor wrapper
Create a dual data source that will automatically switch between Apex Rest or Apex Remote (if available).
Apex Rest API Input.
Apex Remote Input.
a instance of DualDataSource.
Create a new integrationProcedure wrapper
Create a new Rest wrapper
Create a new Soql wrapper
Create a new Sosl wrapper
Returns the version number of SDK.
Returns SDK version number as string
Adds all the enumerable string keyed function properties of a source
object to the sdk prototype.
.extend should only be used to add new methods and it won't override the existing methods.
Note: If the property already exists, it will be not be added.
Custom functions which are being extended should have proper namespaces to avoid issues during upgrades. When Vlocity releases new changes it won't impact if unique namespaces are used.
Example: myCompanyOrFeatureMethodName
The object of functions
Get an instance of DataSource if it exists. Otherwise, create a new one with the given config.
DataSource instance.
Adds all the enumerable string keyed function properties of a source object to the sdk prototype.
.override method should only be used to override the existing methods and should only be used in rare cases.
Overriding the existing or default methods may cause unintended consequences and may also impact during upgrades.
Please be cautious while using this
The object of functions
Generated using TypeDoc
DataSource SDK This SDK handles the connection with SalesForce and provide convenient ways to access Vlocity integration including DataRaptor, Integration Procedure, Apex REST API etc.
How to create a Datasource?
Getting an instance of the DataSource
// Obtain a singleton dataSourceService const dataSourceService = DataSource.getInstance({ salesforceUrl: "https://www.salesforce.com", sessionId: "123", create: false, userId: "test" //additional data });Creating a custom datasource at runtime
const newDataSource = { oracle: () => { return "I'm a Custom implementation"; }, siebel: () => { return "I'm a Custom implementation"; } }; dataSourceService.create(newDataSource, isNewInstance); // Create function implementation looks like this // uses prototype to add methods to dataSourceService DataSource.mixin(DataSource, newDataSource, isNewInstance); // call dataSourceService .siebel() .execute(input) .then() .catch();Using ApexRest
datasource .apexRest({ method: "get", url: "/vlocity_cmt/v2/cpq/carts/80137000000WlMP/products?hierarchy=1&pagesize=10&fields=IsActive,Id,Name,UnitPrice,ProductCode,jraju_card__RecurringPrice__c&includeIneligible=true" }) .execute() .then(resp => Logger.log("resp from thenable", resp)) .catch(error => Logger.log("response from catch thenable", error));Using Rest
const input1: IRestInput = { url: "/test.json" }; datasource .rest(input1) .execute() .then(response => { Logger.log("call ", response); }) .catch(error => { Logger.log("fail", error); });Using SOQL
datasource .soql({ query: "SELECT Id, Name FROM Account LIMIT 10" } as ISoqlInput) .execute() .then(response => { Logger.log("soql call ", response.records); }) .catch(error => { Logger.log("soql fail", error); });SOSL call
datasource .sosl({ query: "FIND {Un*} IN ALL FIELDS RETURNING Account LIMIT 10" } as ISoslInput) .execute() .then(response => { Logger.log("sosl call " + response.searchRecords); }) .catch(error => { Logger.log("sosl fail" + error); });