function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
IvanB@LMIvanB@LM 

Composite fields to enforce uniqueness - custom object.

Hi, experts - How can I have behavior in a custom object where using two fields (uniqueness) I need to restrict users not to enter duplicate rows ? In a relational database it would be like creating a composite index unique key; thanks
Best Answer chosen by Admin (Salesforce Developers) 
venkat-Dvenkat-D

AFAIK, the way to achieve this is create a new field which will be Unique and CaseSensitive. Use workflow or trigger to populate that field with combination of your two fields.

This will ensure that you have composite unique key.