Docs/Connectors

Salesforce

Accounts, contacts, opportunities, cases and tasks as records, and field history as episodes, through a connected app.

The salesforce connector reads standard and custom objects through SOQL, and builds episodes from field history.

Connector name salesforce
Products Records, episodes
Credentials A connected app's client ID and secret and a refresh token, or an access token and instance URL
Permissions API Enabled, plus read access to each object and its field history

What it pulls

Records. By default Account, Contact, Opportunity, Case and Task. For each object, the connector asks Salesforce for the object's fields and selects all of them except base64, address and location compound fields. Each record is recorded under the object's name in lower case (opportunity). Set objects to read a different list, including custom objects such as Invoice__c.

Episodes. By default OpportunityFieldHistory and CaseHistory. For every opportunity or case with a change in the run window, the connector reads its full field history: when it was created, and each change with the field, old value, new value, time and the name of the person who made it. Owner changes are kept by name rather than by user ID. Set historyObjects to add others, such as AccountHistory or a custom object's Foo__History.

Field history only covers fields that have history tracking turned on in Salesforce. See Data formats for how events become episodes.

Credentials

For scheduled runs, use a connected app with a refresh token:

  1. Create a connected app in Salesforce Setup with OAuth enabled and the api and refresh_token scopes.
  2. Authorize it as a user with the API Enabled permission and read access to every object you pull.
  3. Give the SDK the clientId, clientSecret and refreshToken.

The refresh token returns the instance URL, so instanceUrl is optional in this setup. For a sandbox, set loginUrl to https://test.salesforce.com.

For a one-off run you can pass accessToken with instanceUrl instead.

Connect

bash
datayield connect salesforce -o clientId=<consumer key> \
  -o clientSecret=env:SF_CLIENT_SECRET -o refreshToken=env:SF_REFRESH_TOKEN \
  -o objects=Account,Opportunity,Case

Secret options passed directly are saved to ~/.datayield/credentials. Values written as env:NAME are read from the environment at run time, which suits CI. See CLI reference.

Options

Option Required Meaning
clientId, clientSecret, refreshToken for scheduled runs Connected app credentials. The secret and the token are stored as secrets.
accessToken, instanceUrl instead of the above A session token and https://yourcompany.my.salesforce.com
loginUrl no Token endpoint host. Defaults to https://login.salesforce.com.
apiVersion no Defaults to v61.0.
objects no Objects to pull as records
historyObjects no History objects to read as events. An empty list turns episodes off.

New records on each run

Records are selected by SystemModstamp between the last successful run and now, so edited records are sent again. For episodes, a record with any history entry in the window has its whole history read again, up to the end of the window, so each episode is complete.