If I have 2 custom objects, object A and object B, and both have an external ID field, is it acceptable to allow duplicates between objects?
What I mean is if "ext_0000001" exists for a record in object A and also in record for object B, will this cause problems?
Attribution to: Adam
Possible Suggestion/Solution #1
It have to be unique per object no per environment.
Attribution to: Artur Kępczyński
Possible Suggestion/Solution #2
This won't cause problems - the uniqueness is only on a per object basis.
Attribution to: Richard Durrant
Possible Suggestion/Solution #3
Just to make it clear, External Id and Unique are two completely independent configurations in a field.
External Id performs two important actions on the underlying metadata of a field. First is creates an ExtId-to-Id map that is can be used for cross-object mapping during upsert operations and data imports. Second, it indexes the field. It does not force a uniqueness rule on the field.
Setting a field to Unique also performs two actions on the behavior of a field. First is that it enforces a field to be unique. Second is that it adds an index to a field.
If field is both External Id and Unique, there is only one index added to the field with regard to the limit on number of indexed fields allowed per object.
My best guess as to why External Id is not necessarily unique is that this is the way you can make a field indexed, without also making it unique without contacting support and asking for an index to be added.
I would take it a step further than other answers to state that uniqueness is actually a per-field basis. I could have two unique fields on the same object. If each of those fields had a value 'MyValue12345', there would be no violation of the unique rule for either field.
Attribution to: pchittum
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/30774