Salesforce (Sales & Service Cloud) integration
Google Cloud Cortex Framework transforms raw Salesforce Sales Cloud and
Salesforce Service Cloud objects into analytics-ready BigQuery
tables by using the prebuilt cortex.sfdc data foundation and data product
modules. To deploy these prebuilt modules, you replicate standard Salesforce
objects (SObjects) into a raw BigQuery dataset where generated
Dataform pipelines deduplicate changes and apply business logic.
If you want to query unified customer profiles or Data Model Objects (DMOs) from Salesforce Data 360 (formerly Data Cloud) without copying data, see Salesforce Data 360 integration.
Replication options
You can populate the raw Salesforce dataset in BigQuery by using either of the following approaches:
- BigQuery Data Transfer Service for Salesforce (recommended): Built-in Google Cloud connector that schedules recurring full or incremental transfers from Salesforce into BigQuery (supporting Salesforce Bulk API v1 version 64.0) without third-party infrastructure. To set up a transfer job, see the Salesforce transfer guide.
- Third-party ELT or CDC connectors: Any replication tool that lands raw Salesforce SObjects in BigQuery while preserving standard Salesforce object names, column names, data types, and system audit fields.
BigQuery Data Transfer Service configuration hints
When configuring BigQuery Data Transfer Service for Salesforce transfer jobs for the supported SObjects, apply the following settings:
- Split the SObjects across transfer configurations (10-object limit):
BigQuery Data Transfer Service recommends a maximum of 10 objects (
assets) per transfer configuration and at most 10 simultaneous transfer runs to avoid Salesforce Bulk API processing delays or skipped runs. Group your transfer configurations to match the defaulthourlyanddailyDataform tags intable_settings.default.yaml:- Hourly incremental transfers (
hourlytag, CDC SObjects):Case,CaseComment,CaseHistory,EmailMessage,Event, andTask. - Daily incremental transfers (
dailytag, CDC SObjects, split across two configurations of up to 10 objects):Account,Asset,Campaign,CampaignMember,Contact,DatedConversionRate,Group,Lead,Opportunity,OpportunityContactRole,OpportunityHistory,OpportunityLineItem,Pricebook2,PricebookEntry,Product2,Profile,User, andUserRole. - Daily full-snapshot transfers (
isCdc: false, reference SObjects): ConfigureCurrencyType,Organization, andRecordTypewith Full ingestion (ingestionType: "full").
- Hourly incremental transfers (
- Select watermark and primary key columns for incremental transfers: For
the incremental SObjects (
ingestionType: "incremental"), setwatermarkColumnstoSystemModstampfor SObjects and toCreatedDateforCaseHistory(which is append-only and lacksSystemModstamp). When using Upsert write mode, setprimaryKeysto["Id"]for each object. - Match the DTS write mode (
WRITE_MODE_APPENDorWRITE_MODE_UPSERT) to your foundationexternalsetting:- Standard foundation mode (
external: false, default): Works with raw landing datasets populated using Append write mode (writeMode: "WRITE_MODE_APPEND") or Upsert write mode (writeMode: "WRITE_MODE_UPSERT"). Thecortex.sfdc.foundations.sfdcmodule deduplicates incremental batches byId, normalizes rawPascalCaseDTS table names intosnake_casefoundation tables (CampaignMembertocampaign_member,OpportunityLineItemtoopportunity_line_item,Pricebook2topricebook2,RecordTypetorecord_type), and attaches curated table and column descriptions fromannotations/*.yaml(because raw DTS transfers don't replicate Salesforce field descriptions). - External deduplicated mode (
external: true, omittingdataTargetId): When a landing dataset already maintains deduplicated records in BigQuery (such as aWRITE_MODE_UPSERTlanding dataset likeSFDC_RAW_UPSERTor an external pipeline), settingexternal: trueskips foundation.jsmodel generation and registers thedataSourceIdtables directly as Dataform sources (definitions/sources/). Because prebuiltcortex.sfdc.products.*models referencesnake_casefoundation table names (account,opportunity_line_item,currency_type), keepexternal: falsewhen landing rawPascalCaseDTS tables for prebuilt data products.
- Standard foundation mode (
Before you begin
Before you run uv run cortex-build for Salesforce modules, complete the
following prerequisites:
- Enable the BigQuery (
bigquery.googleapis.com) and Dataform (dataform.googleapis.com) APIs in your target project, and enable the BigQuery Data Transfer Service API (bigquerydatatransfer.googleapis.com) if you use BigQuery Data Transfer Service for Salesforce. - Create a raw BigQuery dataset (for example,
cortex_sfdc_raw) in the same BigQuery location as your target foundation and data product datasets. - Replicate the Salesforce SObjects required by your selected modules into the
raw dataset. For the complete list of supported SObjects, see
Data foundation tables for Salesforce.
If your Salesforce organization uses multiple currencies, replicate
CurrencyType(andDatedConversionRatewhen Advanced Currency Management is active) and include theCurrencyIsoCodefield on all SObjects that store monetary amounts so downstream currency conversions resolve accurately. - Grant the required Identity and Access Management (IAM) roles across your source,
build, and target projects:
- CLI build principal (
uv run cortex-build): BigQuery Data Viewer (roles/bigquery.dataViewer) on the raw Salesforce dataset and BigQuery Job User (roles/bigquery.jobUser) onbuildProjectId. Unlike SAP ERP, Salesforce doesn't require a metadata dictionary table such asDD03L; the build tool inspects raw table schemas directly through the BigQuery API. - CLI deploy principal (
uv run cortex-deploy): Dataform Editor (roles/dataform.editor) on the Dataform repository project, and BigQuery Data Editor (roles/bigquery.dataEditor) on the target projects or datasets (to inspect or create target datasets with--create-datasets). - Dataform execution service account: BigQuery Data Viewer
(
roles/bigquery.dataViewer) on the raw Salesforce dataset, BigQuery Data Editor (roles/bigquery.dataEditor) on the target foundation and data product datasets, and BigQuery Job User (roles/bigquery.jobUser) on the execution project.
- CLI build principal (
Requirements for replicated Salesforce tables
Verify that your replicated Salesforce tables in BigQuery meet the following schema and behavioral requirements:
- Use standard Salesforce
PascalCaseAPI names for raw tables (for example,Account,OpportunityLineItem,Pricebook2, andCaseHistory) and preserve originalPascalCasecolumn names (such asId,AccountId,SystemModstamp, andIsDeleted). By default, thecortex.sfdc.foundations.sfdcmodule normalizesPascalCasesource table names intosnake_casetarget tables and.jsdefinitions (such asaccount,opportunity_line_item,pricebook2, andcase_history, while preserving existing underscores on custom objects such asMy_Custom_Object__ctomy_custom_object__c) and keepsPascalCasecolumn names; downstream data products expose curatedsnake_casecolumns. If a raw table uses a non-standard or prefixed physical name (for example,raw_Account), copy the full default table list fromsrc/data_modules/cortex/sfdc/foundations/sfdc/table_settings.default.yamlinto a customtable_settings.yamlfile (wired withtableSettings) orinlineTableSettings, and update the target entry withsource.tableName(the physical raw table name) andsource.sfdcTableName(the canonical Salesforce SObject API name, for example,Account). On a foundation module,tableSettingsandinlineTableSettingsreplacetable_settings.default.yamlcompletely rather than merging with it; declaring only the renamed table removes all other SObjects and fails validation for enabled prebuilt Salesforce data products. The builder resolvesannotations/<snake_name>.yamland derives the defaultsnake_casetarget table name fromsource.sfdcTableNameunless you overridetarget.tableName. Include the primary key column (
Idby default, or custom key columns configured insource.keys) and at least one system timestamp column on every Change Data Capture (CDC) table (isCdc: true). During incrementalMERGEexecution, Cortex Framework selects the watermark column in the following priority order:SystemModstamp(preferred; captures both user edits and automated system updates)LastModifiedDateCreatedDate(used for append-only history objects such asCaseHistorythat lackSystemModstamp)
Each incremental run applies a 10-minute lookback window (
INTERVAL 10 MINUTE) against the maximum target watermark to capture late-arriving records without gaps.Replicate low-volume administrative reference objects (or custom objects that lack incremental watermark columns) as full snapshots (
ingestionType: "full"in BigQuery Data Transfer Service). In the default Salesforce foundation configuration,CurrencyType,Organization, andRecordTypesetisCdc: falseand rebuild completely during each pipeline run.Preserve the boolean
IsDeletedcolumn on deletable SObjects so soft-deleted records remain auditable. The foundationMERGElogic updates deleted rows in place and retains them withIsDeleted = TRUE(exposed asis_deleted = TRUEin source-aligned data products) to maintain historical referential integrity. Downstream consumption overview tables and child array rollups automatically exclude rows whereis_deleted = TRUE.Replicate any Salesforce custom fields (
*__c) that you want to expose in reporting. Only the Salesforce foundation builder (SfdcFoundationBuilder, used bycortex.sfdc.foundations.sfdc) detects raw*__ccustom and managed-package columns at build time and propagates them into conformed foundation tables (onSchemaChange: "EXTEND"on CDC tables). Prebuilt Salesforce data products (both source-aligned and consumption) define explicit column projections in their.jsdefinitions for standard canonical columns only so schemas remain deterministic. To expose*__cfields in analytics, query the conformed foundation tables from a custom or extended data product in your custom namespace.
Configure the Salesforce foundation module
In config/config.yaml, register the cortex namespace, declare your raw and
target datasets under data.datasets, add the cortex.sfdc.foundations.sfdc
foundation module, and bind downstream Salesforce data products in
dependencyBindings:
buildEnvironment:
buildProjectId: BUILD_PROJECT_ID
data:
bigQueryLocation: US
namespaces:
- name: cortex
# Register raw inbound and target conformed/product datasets.
datasets:
- id: sfdc_raw
projectId: SOURCE_PROJECT_ID
datasetId: cortex_sfdc_raw
- id: sfdc_foundation
projectId: TARGET_PROJECT_ID
datasetId: cortex7_sfdc_data_foundation
- id: sfdc_products
projectId: TARGET_PROJECT_ID
datasetId: cortex7_sfdc_products
modules:
foundations:
# Salesforce foundation module instance.
- moduleId: sfdc
modulePath: cortex.sfdc.foundations.sfdc
dataSourceId: sfdc_raw
dataTargetId: sfdc_foundation
enabled: true
external: false
# Optional custom table settings file (relative to 'config/') or
# inlineTableSettings (mutually exclusive); replaces
# table_settings.default.yaml completely:
# tableSettings: "cortex/sfdc/foundations/sfdc/table_settings.yaml"
products:
# Source-aligned Salesforce data products bind to sfdcModule.
- moduleId: sfdc_accounts
modulePath: cortex.sfdc.products.accounts
dataTargetId: sfdc_products
dependencyBindings:
sfdcModule: sfdc
enabled: true
syncToKc: true
# Consumption data products bind to enabled source-aligned moduleIds
# (ensure each bound upstream moduleId is also declared in products).
# - moduleId: sfdc_opportunity_pipeline
# modulePath: cortex.sfdc.products.opportunity_pipeline
# dataTargetId: sfdc_products
# dependencyBindings:
# sfdcAccounts: sfdc_accounts
# sfdcConfiguration: sfdc_configuration
# sfdcCurrencyAndConversion: sfdc_currency_and_conversion
# sfdcOpportunities: sfdc_opportunities
# sfdcProductsAndPricing: sfdc_products_and_pricing
Replace the following:
BUILD_PROJECT_ID: the Google Cloud project ID that runs build and validation jobs, for example:my-build-project.SOURCE_PROJECT_ID: the Google Cloud project ID that hosts your replicated raw Salesforce dataset, for example:my-source-project.TARGET_PROJECT_ID: the Google Cloud project ID where Cortex Framework creates foundation and data product tables, for example:my-target-project.
If you ingest data from multiple Salesforce organizations, declare separate raw
and foundation dataset entries and register a distinct foundation moduleId
(for example, sfdc_amer and sfdc_emea) for each organization. Note that
soft-delete state is preserved in place using the IsDeleted column (the legacy
v6 removeIsDeleted key isn't supported).
After you configure config/config.yaml (including the deployment target
repository settings), compile and deploy your pipelines:
export CORTEX_CONFIG_FILE=config/config.yaml
uv run cortex-build-and-deploy --config $CORTEX_CONFIG_FILE
Then run the generated Dataform actions as described in Post-deployment steps.
What's next
- Explore the prebuilt tables in Data foundation tables for Salesforce.
- Review the source-aligned and consumption models in Data products for Salesforce.
- Configure zero-copy data sharing in Salesforce Data 360 integration.
- Complete your YAML setup in Deployment configuration.