CRM Integration Technical Process - Salesforce

Last updated: December 20, 2025

This article provides a detailed overview of the technical process behind the Salesforce integration. It's helpful for a client's Data Governance team to evaluate technical approach before proceeding with system integration.

Data Reading & Storage

CRED system uses a data sync service pattern to read from Salesforce and store data locally, mapping Salesforce IDs to local entities.
Data Reading Flow
1. Salesforce API Connection
2. Reading Data from Salesforce
3. Extracting Salesforce ID
Data Storage Flow
1. Saving Import Record
2. Storing Salesforce ID on Entity
3. CRM Source Column Mapping

Salesforce ID Logic Summary


Extraction:

The Salesforce ID comes from the Id field in the API response (configured per entity type in fields.ts).
Storage:

Stored in record.dataId during the read process.
Entity assignment:

Assigned to the entity's salesforceId column via crmSourceColumnId().
Uniqueness:

Each entity type has a unique constraint on [userCompanyId, salesforceId] to prevent duplicates.

Entity Configurations

Each entity type has a configuration defining:
idField: The Salesforce field containing the ID (usually "Id")
nameField: The field used for the entity name
modifiedDateField: Used for incremental syncs
mapFields: Field mappings for relationships
This ensures Salesforce IDs are correctly extracted, stored, and used for syncing and relationship mapping.

Storage Architecture

Screenshot 2025-11-13 at 8.42.10 AM.png

Integration Layer


Middleware or connectors used to sync data between internal systems and Salesforce.

Primary Connector: jsforce SDK
┌─────────────────┐
│  GraphQL API    │
│   / REST API    │
└────────┬────────┘
         │
         ▼
┌─────────────────────────┐
│  DataSyncUseCase        │
│  (Read/Create/Update)    │
└────────┬────────────────┘
         │
         ▼
┌─────────────────────────┐
│  SFDataSyncService      │
│  (Business Logic)       │
└────────┬────────────────┘
         │
         ▼
┌─────────────────────────┐
│  sf-api.ts              │
│  (API Wrapper)          │
└────────┬────────────────┘
         │
         ▼
┌─────────────────────────┐
│  jsforce Connection     │
│  (SDK Layer)            │
└────────┬────────────────┘
         │
         ▼
┌─────────────────────────┐
│  Salesforce REST API    │
│  (External System)      │
└─────────────────────────┘

Security & Compliance

Authentication, encryption, and access control measures applied during data transfer and storage.

Screenshot 2025-11-13 at 9.01.25 AM.png


Additional security features

Token existence validation: Verifies tokens exist in database (configurable)
Trusted issuers: Supports trusted JWT issuers for service-to-service auth
Memory security: Clears sensitive data from memory after use
Query-level isolation: All database queries enforce tenant boundaries
Access level checks: Public/Private resource access control
Share validation: Explicit sharing required for cross-user access

This multi-layered approach provides authentication, encryption in transit and at rest (for sensitive tokens), and granular access control with tenant isolation.

Update & Sync Frequency

The system uses event-driven and on-demand syncs rather than fixed schedules, with a default 2-day lookback for incremental reads.

Screenshot 2025-11-13 at 9.08.02 AM.png