Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers 3

up vote 2 down vote accepted

This won't cause problems - the uniqueness is only on a per object basis.

share|improve this answer
add comment

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.

share|improve this answer
add comment

It have to be unique per object no per environment.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.