function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rakesh ERakesh E 

Differences between External ID and Unique field

 Hi,

 

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

 

Thanks

sfdcfoxsfdcfox

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().

SFFSFF

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

souvik9086souvik9086

Hi,

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.

 

Thanks

 

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