Overview
The Salesforce Import templated script gives you the ability to connect to Salesforce and move contacts, accounts, and other Salesforce objects into Platform. This import script uses Salesforce API v55.0 and Bulk API 2.0 Query.
In order to use the Salesforce Import script, you will need a user credential and client credential for your Salesforce account. For more information on how to set up these credentials, please see the following help article: Setting Up Salesforce Credentials.
Key Features
- Optionally fetch deleted records for a Salesforce object.
- Run Incremental (e.g., daily) sync.
- Upsert of imported records.
Getting Started
You can create your script using this link, or in Platform you can navigate to Data → Imports → Salesforce.
Fill out the following parameters (required parameters are marked with a red asterisk in the template).
Parameters
- Script Mode (required): The mode for the script to run against. The options are:
- Run: Fetch Salesforce object records and write them to your destination database.
- Test connection: Test connectivity. Checks if calls can be made to Salesforce.
- List-objects: Show details of all Salesforce objects.
- Help: List all modes and the version of the import.
- User Credential (required): A valid credential containing the appropriate username and password.
- Client Credential (required): A valid credential containing the appropriate username and password.
- Salesforce Instance URL (optional): An organization Salesforce instance, developer instance, sandbox etc.
- Salesforce Object (optional): Salesforce object to sync, e.g., Contact.
- SOQL Query (optional): A custom SOQL query if you don't want to run the default for importing the entire object specified by “SALESFORCE OBJECT.”
- Destination Database (required): The database in which to write records to.
- Destination Database Credential (required): A valid database credential for the cluster.
- Schema and Table (required): The schema and table name you would like to import the data into, e.g. “schema.table”.
- If Table Exists (optional): The action to take if a table with the requested name already exists.Options are:
- Fail: The sync job fails if the table exists
- Append: Records will be appended to the existing table
- Truncate: Records on the table will be wiped out while maintaining the current columns.
- Drop: Removes the entire table including column information.
- Upsert: Update or insert records into the specified table. The upsert mode modifies the table by leveraging the Salesforce record Id (primary key) as well as lastmodifieddate and systemmodstamp (last modified keys) to modify existing records or add new ones. Visit Upsert Mode for more information on how it works.
- Max Errors (optional): The maximum number of rows with errors to remove from the Civis Platform table import before failing. Defaults to 0 (i.e., no errors allowed).
- Diststyle (optional): The distribution style for the resulting table. One of 'even', 'all' or 'key'. Defaults to 'key'.
- Distkey (optional): The column to use as the distkey for the table. Defaults to 'id'. If you import data that doesn’t have a column named ‘id’, please provide the column name for the primary key.
- Sortkey1 (optional): The column to use as the sortkey for the table.
- Sortkey2 (optional): The second column in a compound sortkey for the table.
- Incremental Sync (optional): Sync recently modified records. Start date or day values need to be specified when running incremental sync.
- Start Date (optional): Date to start syncing records from. The start date is used with incremental sync.
- End Date (optional): Date to end syncing records. The end date is used with incremental sync.
- Days (optional): How many days back to sync records from. The “days” value is used with incremental sync. To make sure no data is missed, days will always go backward from midnight UTC.
- Query All (optional): Fetches all existing and deleted records that are on Salesforce. If not checked, it only fetches records that have not been deleted. For example: A record already exists in Redshift and is subsequently deleted from Salesforce. If "Query All" is not checked, the deleted record is ignored by the sync, and is not altered in the Redshift table. If "Query All” is checked, the deleted record is synced to Redshift with “IsDeleted” set to “true”. (If the “upsert” option is also checked, this will modify the existing record in Redshift to set “IsDeleted” to “true”.)
- Get Fields metadata (optional): When a SOQL query is provided and “get fields metadata” is selected, the metadata for each field will also be fetched.
Comments
0 comments
Please sign in to leave a comment.