Importing Records with External ID in Salesforce

Salesforce allows importing records with the external IDs. While importing the custom objects such as accounts or opportunities, we can use an external ID, that will prevent the creation of duplicate records during an import. In Salesforce, the external ID is a custom field with an external ID  attribute.  This means that it contains unique identifies outside the Salesforce platform. It works in a very simple way, once the external ID option is selected, the data import wizard traces out all the existing records on Salesforce which are tagged with external IDs, that match the values given in the import file.

Salesforce limits the external ID fields per object to 25. Only custom fields can be used as external IDs. The allowed data types are number, text, or email id. During the import process, the upsert call is used for matching against the External IDs.  The value stored in the external ID should be unique, and it can be determined whether it is case sensitive or not. When a specific filed is marked as an external ID, it will be automatically indexed. That is the run whenever any filter is executed on them, it runs much faster.

A common use of external ID on Salesforce

Primarily, external ID can be used for preventing duplicated records. Duplicate data aids in an increase in storage in Salesforce. As we know, that Salesforce functions in a subscription model, and space are assigned as well limited as per the subscription. Hence, in this case, space needs to be utilized efficiently. That is why eliminating the duplicate data will help in preserving the allocated space. It is also used with UPSERT DML operation, for integrating with the other systems.

The use case for external ID

Think about a scenario, when we update the record in salesforce. It is done with the help of Record_ID. But, if the update is happening for an external system, then obviously we are not going to have Record_ID in the external data file or system. The solution to this problem is the creation of an external ID. In this case, we assign one field as External ID in Salesforce, and based on this field we can import records from an external system.  

Imagine you have some financial records, and you want to import the same to salesforce.  Here, we will create one External Id that will hold the ID from the external system. Now we can import the records with the help of the External ID field, instead of the Salesforce ID field.

Creating an External ID

  • Steps for creating an External ID.
  • To create an external ID, go to “Setup
  • From the quick find box go to “Object Manager”.
  • Select the object with which this external ID will be associated to. For example, we have selected the “Contact” object. Go to “Contact”.
  • Then click on “Custom Fields & Relationships”, and then click on “New”.
  • In the next step, select the data type of the field. So if it is “Text”, select it as “Text”. 
  • Provide the following details: Field Label, Length, Field Name, Description.


  • Check the “External ID” option and then click on “Next”. Set the field level security, and then click on “Save”.

The external ID is now created, and we can start importing using this external ID.

Scroll to Top