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
Justin J. YueJustin J. Yue 

Create Composite Key for Your Custom Object

In Salesforce, the Id field is the primary key for any SObject. Users can also create a custom text field and make it unique, but users cannot create a composite key for a SObject.

A Composite key is very important in certain scenarios. It will help you maintain the data integrity and is a basic feature in any relational databases. Even though Salesforce uses Oracle, it hides this feature in its Force.com development platform.

There is a quick way to mimic composite key feature in SFDC. See this thread http://wp.me/p19Otf-2x for details.