Creating a List Custom Setting involves schema definition, data population, and Apex access. The steps below cover the full setup.
- Decide List versus Hierarchy versus CMDT
List for per-record-identified-by-name configuration. Hierarchy for per-user variance. CMDT for shared reference data that should deploy with releases.
- Create the Custom Setting
Setup > Custom Settings > New. Name it, set Type to List, choose Public or Protected visibility. Save.
- Add fields
From the detail page, add fields for the values you need (Text, Number, Email, Checkbox). Field types are limited; complex types require a custom object instead.
- Populate records
Manage > New. Add records with Name and field values. For bulk, use Data Loader.
- Access from Apex
Call MySetting__c.getValues('SomeName') for one record. Call MySetting__c.getAll() for the full map keyed by Name.
- Plan deployment
Schema deploys through changesets. Data does not. Write a post-deployment Apex script or Data Loader job to populate each target environment.
- Document the setting
Add field-level help text and a comment in the Apex code referencing the setting. Future developers will need to understand the purpose.
Primary identifier for each record. Use a meaningful naming convention.
Text, Number, Email, Checkbox, Phone, URL, etc. Limited compared to custom objects.
Accessible from any Apex code. The standard choice.
Accessible only within the same namespace. For managed packages.
One record by name versus all records as a Map.
- Data does not deploy through changesets. Plan recreation or population in each environment.
- 10 MB cap across all Custom Settings. Hitting it blocks new records.
- Update propagation takes a few seconds. Immediate reads may see stale values.
- Field types are limited. For complex configuration, use a custom object instead.
- Custom Metadata Types are the modern alternative for deployable configuration. Reach for them first.