Fatskills
Practice. Master. Repeat.
Study Guide: Salesforce Dynamic Forms and Dynamic Actions - Zero-Fluff, Hands-On Study Guide
Source: https://www.fatskills.com/hesi/chapter/tech-salesforce-dynamic-forms-dynamic-actions-zero-fluff-hands-on-study-guide

Salesforce Dynamic Forms and Dynamic Actions - Zero-Fluff, Hands-On Study Guide

By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.

⏱️ ~8 min read

Salesforce Dynamic Forms & Dynamic Actions: Zero-Fluff, Hands-On Study Guide

(For Admins Who Need to Ship, Not Just Pass Exams)


1. What This Is & Why It Matters

Dynamic Forms and Dynamic Actions are two of Salesforce’s most powerful (and underused) features for building flexible, user-friendly page layouts without code. They let you: - Show/hide fields and actions based on record data, user permissions, or device type (e.g., hide a "Manager Approval" button if the user isn’t a manager). - Replace clunky, one-size-fits-all page layouts with dynamic, context-aware UIs that adapt to the user’s needs. - Reduce technical debt by eliminating the need for multiple page layouts or custom Lightning components for simple visibility rules.

Real-world scenario: You inherit a Salesforce org where the Opportunity page layout is a mess—sales reps see 50+ fields, but only 10 are relevant to them. Managers need extra fields for approvals, and mobile users need a stripped-down view. Without Dynamic Forms, you’d need: - 3 separate page layouts (desktop, mobile, manager). - Custom Lightning components to hide/show fields. - A maintenance nightmare when fields change.

With Dynamic Forms, you: - Use one layout with visibility rules. - Update fields in one place (no more syncing layouts). - Let users reorder fields without admin help.

Why this matters in production: - Faster user adoption: Reps see only what they need, reducing cognitive load. - Lower maintenance: No more juggling 10 layouts for one object. - Better mobile UX: Hide desktop-only fields on phones/tablets. - Security: Hide sensitive fields (e.g., "Commission Rate") from non-managers.


2. Core Concepts & Components

? Dynamic Forms

  • What it is: A way to control field visibility and layout on Lightning record pages using component visibility rules (no code).
  • Production insight: If you don’t use Dynamic Forms, you’ll waste hours maintaining duplicate layouts. Always prefer Dynamic Forms over multiple page layouts.
  • Key components:
  • Field Section: A container for fields (like a <div> in HTML).
  • Field Visibility Rules: Show/hide fields based on record data, user profile, device type, or formula.
  • Component Visibility: Show/hide entire sections or components (e.g., hide a "Manager Notes" section if the user isn’t a manager).
  • Mobile Layout Overrides: Define a separate layout for mobile without creating a new page layout.

? Dynamic Actions

  • What it is: A way to show/hide buttons and actions (e.g., "Approve," "Submit for Review") based on record data, user permissions, or device type.
  • Production insight: Without Dynamic Actions, users see all buttons all the time, leading to confusion (e.g., a rep seeing a "Manager Approval" button they can’t use). Dynamic Actions = fewer support tickets.
  • Key components:
  • Action Visibility Rules: Show/hide buttons based on record criteria, user profile, or device.
  • Action Overrides: Replace standard actions (e.g., "Edit") with custom Lightning components.
  • Mobile Action Bar: Customize which actions appear on mobile (e.g., hide "Print" on phones).

? Lightning App Builder

  • What it is: The drag-and-drop tool where you configure Dynamic Forms and Dynamic Actions.
  • Production insight: Always test layouts in the "Preview" pane before deploying—visibility rules can behave unexpectedly.

? Record Page Assignments

  • What it is: Controls which users see which page layouts (e.g., "Sales Reps see Layout A, Managers see Layout B").
  • Production insight: Dynamic Forms reduce the need for multiple layouts, but you’ll still use assignments for profile/role-based variations.

? Formula Fields & Visibility Rules

  • What it is: You can use formulas (e.g., ISPICKVAL(Status, "Closed")) to control field/action visibility.
  • Production insight: Formulas are powerful but can get slow if overused. Keep them simple (e.g., Amount > 10000).

3. Step-by-Step Hands-On: Build a Dynamic Opportunity Layout

Prerequisites

Salesforce org (Developer or Sandbox). ? System Administrator permissions. ? Opportunity object with some sample data. ? Basic familiarity with Lightning App Builder.


Step 1: Enable Dynamic Forms & Dynamic Actions

  1. Go to Setup-Object Manager-Opportunity-Page Layouts.
  2. Click Edit on the Opportunity Layout.
  3. Click Upgrade Now (if prompted) to enable Dynamic Forms.
  4. For Dynamic Actions, go to Setup-Object Manager-Opportunity-Buttons, Links, and Actions.
  5. Click Edit on the Highlights Panel and enable Dynamic Actions.

Step 2: Create a Dynamic Opportunity Layout

  1. Go to Setup-App Builder-Lightning App Builder.
  2. Click New-Record Page-Opportunity-Next.
  3. Name it "Dynamic Opportunity Layout"-Next-Clone Salesforce Default-Finish.
  4. Delete the default "Details" tab (we’ll rebuild it dynamically).

Step 3: Add a Dynamic Field Section

  1. Drag a Field Section component onto the page.
  2. Name it "Opportunity Basics".
  3. Click Add Field and select:
  4. Opportunity Name
  5. Account Name
  6. Stage
  7. Close Date
  8. Amount
  9. Click Done.

Step 4: Add Visibility Rules to Fields

Goal: Hide the "Amount" field if the Stage = "Prospecting".

  1. Click the Amount field in the Opportunity Basics section.
  2. Under Field Visibility, click Add Filter.
  3. Set:
  4. Field: Stage
  5. Operator: Not Equal To
  6. Value: Prospecting
  7. Click Done-Save.

Test it: - Open an Opportunity where Stage = "Prospecting"-Amount should disappear. - Change Stage to "Negotiation"-Amount should reappear.


Step 5: Add a Dynamic Action (Hide "Approve" Button for Non-Managers)

Goal: Only show the "Approve" button if the user is a manager.

  1. In Lightning App Builder, click the Highlights Panel (top of the page).
  2. Click Edit Actions.
  3. Find the "Approve" action and click the gear icon-Edit Visibility.
  4. Set:
  5. User Profile: Manager (or a custom permission)
  6. Click Done-Save.

Test it: - Log in as a non-manager-"Approve" button should disappear. - Log in as a manager-"Approve" button should appear.


Step 6: Optimize for Mobile

Goal: Hide the "Next Steps" field on mobile.

  1. In Lightning App Builder, click the Next Steps field.
  2. Under Field Visibility, click Add Filter.
  3. Set:
  4. Device: Desktop
  5. Click Done-Save.

Test it: - Open the page on mobile-"Next Steps" should disappear. - Open on desktop-"Next Steps" should appear.


Step 7: Deploy to Users

  1. Click Activation-Assign as Org Default (or assign to specific profiles).
  2. Click Save-Activate.

4.-Production-Ready Best Practices

? Security

  • Least privilege: Only show fields/actions to users who need them (e.g., hide "Commission Rate" from reps).
  • Avoid hardcoding user IDs: Use profiles, permission sets, or custom permissions instead.
  • Test with real data: Visibility rules can break if picklist values change (e.g., "Stage" renamed from "Prospecting" to "New").

? Cost Optimization

  • Dynamic Forms reduce layout maintenance: Fewer layouts = less admin work.
  • Avoid overusing formulas: Complex formulas can slow down page loads.

Reliability & Maintainability

  • Use naming conventions:
  • DF_Opp_Basics (Dynamic Form section for Opportunity Basics).
  • DA_Approve_ManagerOnly (Dynamic Action for Approve button).
  • Document visibility rules: Add a description to each rule (e.g., "Hides Amount if Stage = Prospecting").
  • Test in Sandbox first: Visibility rules can break in production if data differs.

Observability

  • Monitor page load times: If a page is slow, check for complex visibility formulas.
  • Use debug logs: If a field/action isn’t showing, check: sql SELECT Id, Name, StageName FROM Opportunity WHERE Id = '006XXXXXXXXXXXX' (Replace with your record ID.)

5. Common Mistakes & Traps

Mistake Symptom Fix/Prevention
Using multiple page layouts instead of Dynamic Forms Users complain about missing fields, admins waste time syncing layouts. Always prefer Dynamic Forms for field visibility.
Hardcoding user IDs in visibility rules Rules break when users leave the company. Use profiles, permission sets, or custom permissions.
Overusing formulas in visibility rules Page loads slowly, users complain about lag. Keep formulas simple (e.g., ISPICKVAL(Stage, "Closed")).
Not testing mobile layouts Mobile users see desktop-only fields, leading to confusion. Always test in mobile preview.
Forgetting to activate the layout Users don’t see the new layout. Click "Activation"-"Assign as Org Default."

6.-Exam/Certification Focus (Salesforce Admin)

Typical Question Patterns

  1. "Which feature lets you show/hide fields based on record data?"
  2. ? Dynamic Forms
  3. ? Page Layouts (static)
  4. Record Types (different picklist values, not field visibility)

  5. "How do you hide the 'Approve' button for non-managers?"

  6. ? Dynamic Actions with a profile-based visibility rule
  7. ? Custom Lightning component (overkill)
  8. Removing the button from the page layout (static)

  9. "What’s the best way to show different fields on mobile vs. desktop?"

  10. ? Dynamic Forms with device-based visibility rules
  11. ? Creating separate page layouts (maintenance nightmare)

Trap Distinctions

  • Dynamic Forms vs. Page Layouts:
  • Page Layouts = Static (all users see the same fields).
  • Dynamic Forms = Dynamic (fields hide/show based on rules).
  • Dynamic Actions vs. Custom Buttons:
  • Dynamic Actions = Show/hide standard buttons (e.g., "Approve").
  • Custom Buttons = Require code or Lightning components.

Scenario-Based Question

"You need to hide the 'Discount' field from sales reps unless the Opportunity Amount > $10,000. What’s the best approach?" --Dynamic Forms with a visibility rule: Amount > 10000 --Create a separate page layout for high-value opportunities (too much maintenance). --Use a validation rule (wrong tool for the job).


7.-Hands-On Challenge (With Solution)

Challenge

Build a Dynamic Case Layout where:
1. The "Escalate" button only appears if Status = "New" and the user is a manager.
2. The "Customer Feedback" field only appears if Status = "Closed".

Solution

  1. For the "Escalate" button:
  2. In Lightning App Builder, edit the Highlights Panel.
  3. Click the Escalate action-Edit Visibility.
  4. Add two filters:
    • Status = "New"
    • User Profile = "Manager"
  5. Click Done-Save.

  6. For the "Customer Feedback" field:

  7. Drag a Field Section onto the page.
  8. Add the "Customer Feedback" field.
  9. Click the field-Add Visibility Rule-Status = "Closed".
  10. Click Done-Save.

Why it works: - Dynamic Actions control button visibility. - Dynamic Forms control field visibility. - Combining rules (e.g., Status + Profile) ensures only the right users see the right UI.


8.-Rapid-Reference Crib Sheet

Task How to Do It Exam Trap
Enable Dynamic Forms Setup-Object Manager-[Object]-Page Layouts-Upgrade Now Must be done per object.
Add a visibility rule Edit field/action-Add Filter-Set criteria Rules are AND-based (all conditions must be true).
Hide a field on mobile Field Visibility-Add Filter-Device = Desktop Default is all devices.
Show a button for managers only Dynamic Actions-Edit Action-Profile = Manager Use profiles, not roles.
Test visibility rules Preview in Lightning App Builder Always test with real data.
Deploy to users Activation-Assign as Org Default Must activate after saving.
Debug missing fields Check visibility rules, record data, user profile Picklist values must match exactly.

9.-Where to Go Next

  1. Salesforce Dynamic Forms Trailhead (Official hands-on module).
  2. Dynamic Actions Documentation (Official guide).
  3. Lightning App Builder Guide (For advanced layouts).
  4. Salesforce Admins Blog: Dynamic Forms Best Practices (Real-world tips).

Final Thought

Dynamic Forms and Dynamic Actions are your secret weapons for: ? Faster user adoption (less clutter = happier reps). ? Lower maintenance (one layout, not ten). ? Better security (hide sensitive data automatically).

Your next step:
1. Pick an object (e.g., Case, Account, Opportunity).
2. Replace one static layout with Dynamic Forms.
3. Add one Dynamic Action (e.g., hide "Approve" for non-managers).
4. Deploy and measure (ask users: "Is this layout better?").

You’ve just saved your org 10 hours of layout maintenance. Now go build something dynamic. ?