Salesforce External ID Fields: Complete Guide

Quick Summary:

An External ID field stores a unique identifier from an external system, enabling reliable upsert operations that update existing records or insert new ones based on that external system's own ID.

What Is an External ID Field?

An External ID field is a designation you apply to a Text, Number, or Email field, marking it as containing a unique identifier from an external system -- a legacy CRM's customer number, an ERP's product code. This designation is what makes reliable upsert operations possible, letting integrations match incoming records to existing Salesforce records without relying on the Salesforce record ID itself.

How to Set One Up

  1. Create or edit the relevant Text, Number, or Email field.

  2. Check the External ID checkbox in the field's properties.

  3. Also check Unique if duplicate values should be prevented (recommended for most external ID use cases).

  4. Save, then use this field as the matching key in Data Loader, Bulk API, or REST API upsert operations.

A Real-World Example

A nightly integration syncs product data from an external inventory system, where each product has a unique SKU. A custom field, SKU__c, marked as both External ID and Unique, lets the integration run an upsert operation every night -- products that already exist (matched by SKU) get updated, and genuinely new products get inserted, all in a single, safely re-runnable operation.

💡 Pro Tip

Always pair External ID with the Unique constraint unless you have a specific reason not to -- without uniqueness enforcement, upsert operations can behave unpredictably if the external system's ID scheme ever produces an unexpected duplicate.

Frequently Asked Questions

Can a field be both an External ID and required?

Yes, these are independent settings -- a field can be marked External ID, required, and unique all at the same time if needed.

Does External ID automatically enforce uniqueness?

Not by itself -- you need to separately check the "Unique" option if you want Salesforce to prevent duplicate values, though External ID and Unique are commonly used together.

Can I change a regular field into an External ID after it already has data?

Yes, though if the Unique constraint is also being added, existing duplicate values would need to be resolved first.

Which field types support the External ID designation?

Text, Number, and Email field types can be marked as External ID -- not every field type supports this designation.

How many External ID fields can a single object have?

Multiple fields can be marked as External ID on the same object, useful when integrating with more than one external system that each has its own identifier scheme.

Is External ID required for using upsert operations?

Yes, upsert operations (in Data Loader, Bulk API, or REST API) require an External ID field to determine whether to update an existing record or insert a new one.

Can External ID fields be used in URL construction for direct record links?

Not typically for standard record URLs, which rely on the Salesforce record ID -- External ID is primarily for integration matching, not native navigation.

Does marking a field as External ID affect its visibility to end users?

No, External ID is purely a backend/integration designation -- it doesn't change field-level security or page layout visibility on its own.

Can External ID fields be indexed for faster lookup performance?

Yes, and External ID fields are automatically indexed by Salesforce, which is part of why they perform well for upsert matching even at scale.

What happens if an External ID value in an incoming integration doesn\'t match any existing record?

With an upsert operation, no match means a new record is inserted rather than an existing one being updated -- exactly the intended behavior for handling both new and existing records in one integration flow.