I have a custom object in salesforce where I want to enforce uniqueness across two lookup fields and a date field. I do not want to allow two records to have all three of those fields in common, but if any one is different, then it is ok. Is there an accepted best practice for achieving this? I've thought of a few ways to accomplish this, but I want to do it "right".

  1. Create another field on the record that is a concatenation of all three fields. Use a workflow rule to populate it every time a record is created and check the unique checkbox on that field.

  2. Try to accomplish this with a Validation Rule. (I've tried a few things here, and didn't have much luck.)

  3. Write a full-blown bulkified trigger specifically for this instance. (This seems like a little bit of overkill to do something so standard)

Any comments on these methods or other ones I haven't thought of would be greatly appreciated.

Browse other questions tagged or ask your own question.