Setup is two phases: define the field set in Object Manager, then reference it from Visualforce or LWC code. Most usage involves both an admin creating the field set and a developer consuming it.
- Open Object Manager
Setup, Object Manager, pick the target object. Click Field Sets in the left sidebar. The list shows any existing Field Sets for the object.
- Create the Field Set
Click New. Enter Field Set Label, API Name, and Description. The description is critical; future admins need to know what consuming code expects from this field set.
- Add fields to the Field Set
Drag fields from the In the Field Set panel onto the canvas. Reorder by drag. Mark fields as Required if the consuming code should treat them as mandatory at validation. Save.
- Reference from Visualforce or LWC
Visualforce: <apex:repeat value="{!$ObjectType.MyObject.FieldSets.MyFieldSet}" var="f"><apex:inputField value="{!record[f]}"/></apex:repeat>. LWC: pass the field set name to a component that fetches and renders the field list via @AuraEnabled Apex or lightning-record-form.
- Iterate on the field set, not the code
Once the code references the field set, admins extend or shrink the field list without redeploying. Document the field-set name in the consuming code so future admins know what page or component depends on it.
Per-field setting inside the field set. Marks the field as required at validation in consuming code. The flag does not change object-level required-field metadata.
Drag to reorder. Consuming code renders fields in the field-set order. Reordering changes the rendered output without code changes.
Any field on the object can be added to the field set, including standard fields, custom fields, and formula fields. Cannot add fields from related objects without a custom Apex bridge.
Visualforce (native support), Lightning Web Components (via Apex helper or lightning-record-form), managed packages (extension pattern), Apex (Schema.FieldSet introspection).
- Field-level security applies on top of field sets. A user without read access sees the field as blank, not as removed.
- Renaming or deleting a field that is in a field set silently breaks the field set. Audit field sets after schema changes.
- LWC does not natively support field sets in lightning-record-edit-form. Use Apex helper or lightning-record-form for LWC.
- Field Sets cap at around 50 per object and 100 fields per set. Hit these caps and the platform rejects the addition.
- For standard Lightning record pages, Dynamic Forms is the better tool. Field Sets are for code-driven dynamic rendering, not for record layouts.