Help get this topic noticed by sharing it on Twitter, Facebook, or email.
I’m Frustated

Field combination is unique. Cant use single key as foreign key.

In my table A, I am using foreign key reference as Field1__c:50232 from table B. However, in table B, combination of Field1__c and Field2__c is unique. There are multiple records with Field1__c = 50232 in table B. Resulting in foreign key reference to fail with error Msg: "Field1__c: more than one record found for external id field: [a1in00000004LLeAAM, a1in00000004LLdAAM, a1in00000004LLcAAM, a1in00000004LLfAAM]". Can you please help, how should I go about it?
1 person has
this problem
  • This is a restriction on the salesforce API. The foreign key external reference must point to a single field that is defined as an external ID and is unique over the set of records.

    One solution would be to create a third field and then populate that third field with a concatenation of field 1 and field 2. You would have to do this at record creation time when you were populating field 1 and field 2. Then make field three a unique external id and use it as your foreign key reference. Note that you cannot use formula fields to accomplish this because formula fields cannot be made unique external identifiers.
  • (some HTML allowed)
    How does this make you feel?
    Add Image

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited