+ Start a Discussion
Rakesh ERakesh E 

Differences between External ID and Unique field



Will salesforce allow "null" values for External ID and Unique fields.




Yes, in both cases, unless set to "always required." The difference is that the former can be used with upsert() to insert or update records based on the value in the External ID field, while the latter is simply a uniqueness-constrained field that cannot be used with upsert().


Also, you can only have null in a unique field ONCE ...



Remember that External Id can be used during UPSERT Operation, to automatically check the duplicate entries. It is like a foreign key in a database object while uploading data into salesforec from external legacy systems.

                                     While Unique fields are not used in the UPSERT. They determine the uniqueness.


About the NULL factor, both field can have NULL value unless and until you check the required checkbox or it is required via pagelayout.




If this post answers your question, please mark it as solution.