Skip to main content

salesforce@2.12.0

Modules

Adaptor
FakeAdaptor

Adaptor

Adaptor.relationship

Kind: static class of Adaptor
Access: public

new exports.relationship(relationshipName, externalId, dataSource)

Adds a lookup relation or 'dome insert' to a record.

ParamTypeDescription
relationshipNamestring__r relationship field on the record.
externalIdstringSalesforce ExternalID field.
dataSourcestringresolvable source.

Example

Data Sourced Value:
relationship("relationship_name__r", "externalID on related object", dataSource("path"))
Fixed Value:
relationship("relationship_name__r", "externalID on related object", "hello world")

Adaptor.describeAll

Kind: static class of Adaptor
Access: public

new exports.describeAll(state)

Outputs basic information about available sObjects.

ParamTypeDescription
stateStateRuntime state.

Example

describeAll()

Adaptor.describe

Kind: static class of Adaptor
Access: public

new exports.describe(sObject, state)

Outputs basic information about an sObject to STDOUT.

ParamTypeDescription
sObjectStringAPI name of the sObject.
stateStateRuntime state.

Example

describe('obj_name')

Adaptor.retrieve

Kind: static class of Adaptor
Access: public

new exports.retrieve(sObject, id, callback, state)

Retrieves a Salesforce sObject(s).

ParamTypeDescription
sObjectStringThe sObject to retrieve
idStringThe id of the record
callbackfunctionA callback to execute once the record is retrieved
stateStateRuntime state

Example

retrieve('ContentVersion', '0684K0000020Au7QAE/VersionData');

Adaptor.query

Kind: static class of Adaptor
Access: public

new exports.query(qs, state)

Execute an SOQL query. Note that in an event of a query error, error logs will be printed but the operation will not throw the error.

ParamTypeDescription
qsStringA query string.
stateStateRuntime state.

Example

query(`SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.field1}'`);

Adaptor.bulk

Kind: static class of Adaptor
Access: public

new exports.bulk(sObject, operation, options, fun, state)

Create and execute a bulk job.

ParamTypeDescription
sObjectStringAPI name of the sObject.
operationStringThe bulk operation to be performed
optionsObjectOptions passed to the bulk api.
funfunctionA function which takes state and returns an array.
stateStateRuntime state.

Example

bulk('Patient__c', 'insert', { failOnError: true, pollInterval: 3000, pollTimeout: 240000 }, state => {
return state.data.someArray.map(x => {
return { 'Age__c': x.age, 'Name': x.name }
})
});

Adaptor.destroy

Kind: static class of Adaptor
Access: public

new exports.destroy(sObject, attrs, options, state)

Delete records of an object.

ParamTypeDescription
sObjectStringAPI name of the sObject.
attrsObjectArray of IDs of records to delete.
optionsObjectOptions for the destroy delete operation.
stateStateRuntime state.

Example

destroy('obj_name', [
'0060n00000JQWHYAA5',
'0090n00000JQEWHYAA5
], { failOnError: true })

Adaptor.create

Kind: static class of Adaptor
Access: public

new exports.create(sObject, attrs, state)

Create a new object.

ParamTypeDescription
sObjectStringAPI name of the sObject.
attrsObjectField attributes for the new object.
stateStateRuntime state.

Example

create('obj_name', {
attr1: "foo",
attr2: "bar"
})

Adaptor.createIf

Kind: static class of Adaptor
Access: public

new exports.createIf(logical, sObject, attrs, state)

Create a new object if conditions are met.

ParamTypeDescription
logicalbooleana logical statement that will be evaluated.
sObjectStringAPI name of the sObject.
attrsObjectField attributes for the new object.
stateStateRuntime state.

Example

createIf(true, 'obj_name', {
attr1: "foo",
attr2: "bar"
})

Adaptor.upsert

Kind: static class of Adaptor
Access: public

new exports.upsert(sObject, externalId, attrs, state)

Upsert an object.

ParamTypeDescription
sObjectStringAPI name of the sObject.
externalIdStringID.
attrsObjectField attributes for the new object.
stateStateRuntime state.

Example

upsert('obj_name', 'ext_id', {
attr1: "foo",
attr2: "bar"
})

Adaptor.upsertIf

Kind: static class of Adaptor
Access: public

new exports.upsertIf(logical, sObject, externalId, attrs, state)

Upsert if conditions are met.

ParamTypeDescription
logicalbooleana logical statement that will be evaluated.
sObjectStringAPI name of the sObject.
externalIdStringID.
attrsObjectField attributes for the new object.
stateStateRuntime state.

Example

upsertIf(true, 'obj_name', 'ext_id', {
attr1: "foo",
attr2: "bar"
})

Adaptor.update

Kind: static class of Adaptor
Access: public

new exports.update(sObject, attrs, state)

Update an object.

ParamTypeDescription
sObjectStringAPI name of the sObject.
attrsObjectField attributes for the new object.
stateStateRuntime state.

Example

update('obj_name', {
attr1: "foo",
attr2: "bar"
})

Adaptor.reference

Kind: static class of Adaptor
Access: public

new exports.reference(position, state)

Get a reference ID by an index.

ParamTypeDescription
positionnumberPosition for references array.
stateStateArray of references.

Example

reference(0)

Adaptor.execute(operations) ⇒ State

Executes an operation.

Kind: static method of Adaptor

ParamTypeDescription
operationsOperationOperations

Adaptor.steps() ⇒ Array

Flattens an array of operations.

Kind: static method of Adaptor
Example

steps(
createIf(params),
update(params)
)

Adaptor~createConnection(state) ⇒ State

Creates a connection.

Kind: inner method of Adaptor

ParamTypeDescription
stateStateRuntime state.

Example

createConnection(state)

Adaptor~login(state) ⇒ State

Performs a login.

Kind: inner method of Adaptor

ParamTypeDescription
stateStateRuntime state.

Example

login(state)

Adaptor~cleanupState(state) ⇒ State

Removes unserializable keys from the state.

Kind: inner method of Adaptor

ParamType
stateState

Example

cleanupState(state)

Adaptor~State : Object

Kind: inner typedef of Adaptor
Properties

NameTypeDescription
dataobjectJSON Data.
referencesArray.<Reference>History of all previous operations.

Adaptor~Operation : function

Kind: inner typedef of Adaptor

ParamType
stateState

FakeAdaptor