Prompt

How do I sync contacts between my SaaS app and Salesforce without duplicates?

Technology / API Platforms1 observationLast seen Oct 24, 2026

Latest observation

Oct 24, 2026OpenAI APIWeb search: off

To sync contacts between your SaaS app and Salesforce without creating duplicates, you need a reliable identity-matching strategy plus a two-way sync design that respects ownership and updates.

1) Pick a stable unique key

Do not use name, email, or phone alone as the identity key if you can avoid it.

Best options:

  • Your app’s contact ID stored in Salesforce as a custom field like External_Contact_ID__c
  • Or Salesforce’s Contact.Id stored back in your app after the first sync

Best practice:

  • Treat your system as the source of truth for your contact records
  • Store the mapping:
    • app_contact_id
    • salesforce_contact_id

2) Use upsert, not insert

When syncing from your app to Salesforce:

  • Query Salesforce first for an existing contact by external ID
  • If found: update
  • If not found: create

In Salesforce, use:

  • External ID field
  • Upsert API

Example flow:

  1. App contact 12345
  2. Search Salesforce External_Contact_ID__c = 12345
  3. If exists → update that Contact
  4. If not → create Contact and save returned Salesforce ID

3) Maintain a sync map

Keep a persistent mapping table in your database:

app_contact_idsalesforce_contact_idlast_synced_atsync_version

This prevents repeated “create” attempts and helps with retries.

4) Match existing Salesforce records before creating

If you’re onboarding existing Salesforce data, do a one-time matching pass using a hierarchy like:

  1. Exact external ID match
  2. Exact email match
  3. Exact phone match
  4. Fuzzy match on name + company
  5. Manual review for uncertain matches

Be careful: email can change, and multiple contacts can share the same company/domain.

5) Decide conflict rules

When both systems can edit contacts, define who wins:

  • Last write wins
  • Salesforce wins for certain fields
  • App wins for certain fields
  • Field-level ownership (recommended)

Example:

  • Salesforce owns: lead status, owner, lifecycle stage
  • Your app owns: subscription status, product usage, preferences

6) Prevent duplicate creation with idempotency

For every sync request, make it idempotent:

  • Use the app contact ID as the idempotency key
  • If a retry happens, the same contact should update the same Salesforce record, not create a new one

7) Handle deletes carefully

Avoid hard deletes in both systems unless you really mean it. Prefer:

  • soft delete
  • archived status
  • sync tombstones

8) Reconcile regularly

Even with good sync logic, drift happens. Run a periodic reconciliation job:

  • Find records in Salesforce missing external ID
  • Find app contacts missing Salesforce mapping
  • Detect duplicates by email/external ID
  • Repair or queue for manual review

9) Use Salesforce-native features where possible

Useful tools:

  • External ID fields
  • Upsert API
  • Bulk API for large syncs
  • Change Data Capture or Platform Events for near-real-time updates
  • Duplicate Rules / Matching Rules in Salesforce to reduce bad inserts

10) Recommended architecture

A solid pattern is:

  • Integration service
  • Sync mapping table
  • Webhook/event listeners
  • Upsert to Salesforce
  • Periodic reconciliation job
  • Conflict-resolution rules

Simple sync algorithm

App → Salesforce

  1. Receive contact create/update
  2. Look up mapping by app_contact_id
  3. If mapping exists, update Salesforce by salesforce_contact_id
  4. Else upsert by External_Contact_ID__c
  5. Save mapping

Salesforce → App

  1. Listen for changes via CDC/webhooks/polling
  2. Use salesforce_contact_id to find mapped app contact
  3. If not found, try matching on external ID
  4. Otherwise create or flag for review

Most important rule

Never create a new Salesforce contact unless you’ve first checked for an existing mapped record or matched on a trusted external ID.

If you want, I can also give you:

  • a data model for the sync table
  • a Salesforce upsert example
  • or a step-by-step sync workflow diagram.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.