Sometimes I need to prevent duplicates on a table other than Accounts or Contacts (preventing Account and Contact dupes is, of course, a huge topic in itself). The most-frequent need I've encountered is quotas: I want to allow one quota record per user, per quarter, and prevent duplicates. Assuming I have a custom object called Quota with a picklist on it called "Quarter", here's how I typically do this:
By concatenating (that is, smooshing) the Owner ID and Quarter values together into a single field that requires unique values, Salesforce won't let me create dupes. This general approach works in many situations where I need to guarantee unique records. Give it a try! |