Record Types, Page Layouts, Dynamic Forms, and Picklist Strategy

Share

These tools let you tailor Salesforce so each team sees the right fields, the right options, and the right flow—without cloning objects or creating chaos. Think of them as your toolkit for shaping UX and data quality around real business processes.


Record Types

Record Types let you present different processes, picklist values, and layouts to different users based on their profile. They’re perfect when you’ve got one object serving multiple flavors of the same thing (e.g., “New Business” vs. “Existing Customer” opportunities).

  • Core idea: Create variations of the same object for specific user groups or processes.

  • Where it shines: Limit picklist values, assign targeted page layouts, and support distinct business stages.

  • Why it matters: Users only see what’s relevant, so data entry is faster and cleaner.

Apex: safely get a Record Type Id by DeveloperName

Use this any time you need the right Record Type for inserts or tests—without hardcoding IDs.

public with sharing class RtUtil {
    // Cache to avoid repeat SOQL in same transaction
    private static Map<String, Id> cache = new Map<String, Id>();

    /**
     * Example: RtUtil.idFor('Case', 'Customer_Support');
     */
    public static Id idFor(String sobjectApiName, String developerName) {
        String key = sobjectApiName + '::' + developerName;
        if (cache.containsKey(key)) return cache.get(key);

        Id rtId = [SELECT Id
                   FROM RecordType
                   WHERE SObjectType = :sobjectApiName
                     AND DeveloperName = :developerName
                   LIMIT 1].Id;

        cache.put(key, rtId);
        return rtId;
    }
}

Page Layouts

Page Layouts control what appears (and where) on a record’s detail and edit pages. They’re your traditional, desktop-focused way to arrange fields, sections, buttons, and related lists.

  • Core idea: Structure the record UI on desktop.

  • Where it shines: Group fields, set read-only/required, control related lists and console layout.

  • Why it matters: Clear layouts reduce hunting for fields and make data entry feel obvious.


Dynamic Forms

Dynamic Forms take things further on Lightning pages. Instead of one monolithic layout, you place fields/sections individually and control visibility with conditions like field values or permissions.

  • Core idea: Modern, flexible field/section management directly on Lightning record pages.

  • Where it shines: Conditional visibility (show/hide based on record data or permissions), place fields anywhere, and cut down the number of page layouts.

  • Why it matters: Highly personalized, context-aware pages that boost speed and adoption in Lightning Experience.


Picklist Strategy

A strong picklist strategy keeps data consistent and reporting trustworthy. Plan which values are global, which are restricted, and how they relate to each other.

  • Core idea: Standardize inputs with curated value sets.

  • Where it shines:

    • Global Value Sets: Reuse the same list across fields/objects for consistency.

    • Restricted Picklists: Block values that aren’t approved.

    • Dependencies: Make one picklist’s values depend on another’s selection.

  • Why it matters: Fewer typos, cleaner reports, and simpler choices for users.

LWC (UI API): get picklist values by Record Type (with dependencies)
Great for dynamic UIs—especially with Dynamic Forms or custom components.

// file: picklists.js
import { LightningElement, wire, api } from 'lwc';
import { getObjectInfo, getPicklistValuesByRecordType } from 'lightning/uiObjectInfoApi';
import CASE_OBJECT from '@salesforce/schema/Case';

export default class Picklists extends LightningElement {
  @api recordTypeDeveloperName = 'Customer_Support';
  recordTypeId;
  priorities = [];
  subStatuses = [];

  @wire(getObjectInfo, { objectApiName: CASE_OBJECT })
  wireObjInfo({ data }) {
    if (data) {
      // map devName -> RT Id
      const rtMap = data.recordTypeInfos;
      for (const rtId in rtMap) {
        if (rtMap[rtId].developerName === this.recordTypeDeveloperName) {
          this.recordTypeId = rtId;
          break;
        }
      }
    }
  }

  @wire(getPicklistValuesByRecordType, { objectApiName: CASE_OBJECT, recordTypeId: '$recordTypeId' })
  wirePicklists({ data }) {
    if (data) {
      this.priorities = data.picklistFieldValues.Priority.values;
      // Example of dependent picklist (if using controlling field)
      this.subStatuses = data.picklistFieldValues.Sub_Status__c?.values || [];
    }
  }
}

 

Record Types

Sample Interview Questions (with brief answers)

When would you create a new Record Type vs a new object?

  • Record Type: Same entity, different process/layout/picklists (e.g., SMB vs. Enterprise Opportunity).

  • New object: Different lifecycle, security model, reporting needs, or ownership.

How do Record Types, Page Layouts, and Profiles work together?
Profiles grant access to record types and drive layout assignments. The user’s profile + chosen record type determine the layout and available picklist values.

Dynamic Forms vs. multiple page layouts—how do you decide?
Prefer Dynamic Forms for field-level visibility (record criteria, permissions, device). Keep a few baseline layouts and avoid layout sprawl.

You need roll-ups for a Lookup—what are the options? Trade-offs?
Flow (record-triggered/scheduled), DLRS, or Apex. For large data volumes, lean on scheduled/batch recomputes and ensure bulkification + idempotency.

How do you restrict picklist choices per business process?
Use Global Value Sets with record-type-specific value assignments. Add dependent picklists for hierarchies. Inactivate legacy values rather than deleting.

How would you migrate five similar layouts to Dynamic Forms?
Inventory sections/fields → rebuild as field sections in Lightning App Builder → add visibility rules → user test → deprecate redundant layouts.

How do you set a default Record Type for a user programmatically?
You don’t set it directly with Apex—use Profile/Permission Set defaults. In code, set RecordTypeId on new records to be explicit.

How do you test logic that depends on Record Type?
Create or query the RT in tests (via @testSetup metadata or SOQL), insert records with that RecordTypeId, and assert behavior for each RT.


Wrap-up

Use Record Types for process-specific variations, Page Layouts for basic structure, Dynamic Forms for flexible, conditional experiences in Lightning, and a disciplined Picklist strategy to keep data clean. Together, they deliver a UX that fits how your teams actually work—while protecting the quality of your data.

  • October 17, 2025