External ID in Salesforce

 What is an External ID in Salesforce ?

An external ID is a custom field that has the External ID attribute, meaning that it contains unique record identifiers from a system outside of Salesforce.

What is the maximum number of external IDs an object may have in Salesforce?

We can designate up to 25 External ID fields per object.

What types of fields can be used as an external ID in Salesforce?

Salesforce allows us mark only custom fields with data type text, number or email as External IDs.

Important Points:

  • External ID fields contain record IDs from systems outside Salesforce.
  • We can use the upsert call to match against External ID fields during import or integration.
  • Values in these external ID field must also be unique and we can also determine whether or not value are case sensitive.
  • Custom fields marked as unique also count against an objects limit of external id fields. Unique Fields + external Id fields <= 25.
  • When a field is marked as external Id, the field will be automatically indexed, so selective filters on them should run quickly.

Use of External ID in Salesforce:

  • It becomes searchable in the sidebar search.
  • Salesforce record Id’s are not required to load data.
  • It can be used with UPSERT DML operation to integrate with other systems.
  • The Data Import Wizard detects existing records in Salesforce with external IDs that match those values in the import file.

Example:

When we update or upsert any record in Salesforce we do it by using Record Id. But if we want to update or upsert the record from some External System, we won’t be having Record Id in the External system. So we choose one field as ‘External ID’ in the Salesforce and based on that we can upsert the records from External System.

Let’s say we have a financial system that we want to load records into Salesforce, we could create a External ID field to hold the ID from the other system. We can now upsert records into Salesforce using the external ID field rather than the Salesforce Id field.  

Create a field and set it as an external ID field:

Setup >> Object Manager >> Select any object

for example let’s select, Contact.

Add a custom External ID field to Contact :

Setup >> Object Manager >> Contact >> Custom Fields & Relationships section, click New.

In the Data Type list, select a data type for the field,

In this case select Text and then click Next.

Enter the details for the field, Field LabelLengthField NameDescription.

We can also determine whether or not value are case sensitive. If we want values to be case-sensitive, then check Do not allow duplicate values box, and then click Treat “ABC” and “abc” as different values (case sensitive).

Check the External ID box, and click Next.

Set the field-level security >> click Next >> Save.

The field marked as external ID is created. Now we can use the field as external Id.

Thank you for reading.

No comments: