Use the Salesforce source component to read Salesforce sales cloud standard and custom objects using the Bulk API.
Select an existing Salesforce connection or create a new one.
- Access mode - select object to extract an entire object or query to execute a SOQL query.
- Source object - the table name from which the data will be imported.
- where clause - optional. You can add predicates clauses to the WHERE clause as part of the SQL query that is built in order to get the data from the database. Make sure to skip the keyword WHERE.
prod_category = 1 AND prod_color = 'red'
WHERE prod_category = 1 AND prod_color = 'red'
- Source action - Use
bulk query(default) to read available records or
bulk query allto read available and deleted records.
- Query - type in a SOQL query. Read more about SOQL syntax here.
After defining the source object, select the fields to use in the source.
The fields you select are used to build the SOQL query that will be executed to read the data.
Loading data incrementally from Salesforce
In order to load data incrementally (changes and additions) to objects, the object to synchronize should have the systemmodstamp column. This column is automatically updated whenever a user or an automated process updates a record. Use the following condition in the where clause field with a variable:
SystemModstamp > $lastsysmod
You can use the last successful submission timestamp for the package as you can see in the example below as a value for the variable, or use ExecuteSqlDatetime function to get the last SystemModstamp in your destination database table.
lastsysmod = CASE WHEN (COALESCE($_PACKAGE_LAST_SUCCESSFUL_JOB_SUBMISSION_TIMESTAMP,'')=='') THEN '1900-01-01T00:00:00Z' ELSE $_PACKAGE_LAST_SUCCESSFUL_JOB_SUBMISSION_TIMESTAMP END
In order to store additions or changes in your database destination, make sure to mark the id column as key and change the operation type to "merge":