How to Create Custom Records with Dynamic Forms
What do Salesforce Dynamic Forms entail?
Dynamic Forms are all about making page layouts more user-friendly and tailored to what each user needs at the moment. Over time, the “Details” section on Lightning pages can get cluttered with fields. While these fields are important, they’re not always relevant to everyone or in every situation. Previously, the only way to handle this was by creating multiple page layouts and profiles, which took a lot of effort and setup. Now, let’s walk through how to create custom records using Dynamic Forms.
Are Dynamic Forms Now Accessible for Standard Objects?
As announced during Dreamforce ‘22, Salesforce has expanded the availability of Dynamic Forms to encompass hundreds of standard objects! More precisely, this support has been extended to encompass the majority of LWC-enabled standard objects (Lightning Web Component enabled).
How can I setup Salesforce Dynamic Forms?
- Select an opportunity where you want to create dynamic form.
- Click on the “Edit Page” option to open the Lightning App Builder
- Locate the Fields section and Click on the “upgrade now”
- Select layout. drag the custom fields you created onto the layout. Arrange them as desired to design your dynamic form.
Once your dynamic form is designed and configured, click “Save” to activate the changes and make the dynamic form available for use.
You’ll find your dynamic form with the custom fields you’ve added.
Considerations for Dynamic Forms:
- Density Settings: In Lightning App Builder, most field sections respect the density settings, except for Compact, where labels and values don’t align in the same row.
- Template Switching: Changing templates on a Dynamic Forms page limits you to those that support Dynamic Forms.
- Field Restrictions: Certain fields may automatically be set to Read-Only or Required, and these settings can’t be altered in the properties panel.
- Duplicate Fields: If the same field appears multiple times on a Lightning page, all instances will display identical data, with no option to apply different visibility rules.
- Accordion Limitations: Programmatic accordion components might lack features like lazy loading, available in the App Builder.
- Section Behavior: Expanding or collapsing a section in design mode won’t change how it behaves when the page is live.
- Cloning Records: When cloning records on a Dynamic Forms page with visibility rules, all referenced fields are included, even if they aren’t visible on the page.
- Custom Object Names: If a custom object’s name is left blank when saving, Salesforce will auto-fill it with the record ID. Ensure the Name field is required on the page to prevent this.
- Tablet Display: Field sections inside tabs on tablets have more left padding compared to those outside tabs.
- Mobile Behavior: With Dynamic Forms on Mobile, tapping an address field redirects directly to Google Mapsâ„¢, while without it, users are prompted to open a map app.
General Tips
When creating custom records with Dynamic Forms, it’s best to avoid using both the Record Detail component and field sections on the same page. Mixing them can lead to several user interface issues, such as:
- Overlapping Save and Cancel Bars: When using inline editing, you might encounter multiple save and cancel bars that overlap, creating a confusing experience.
- Visibility Rules: Visibility rules for Field and Field Section components may not work as expected.
- Field Source: When creating, editing, or cloning a record, the fields displayed come from the Field Sections on the page, not from the Record Detail component.
- Tab Order Confusion: Field sections follow a top-down-left-right tab order, while the Record Detail follows a left-right-top-down order, which can be disorienting. Fields within a Field Section might not align horizontally as you’d expect, unlike those in the Record Detail. To keep things aligned horizontally within a field section, make sure to enable the “Align fields horizontally” option.
- Dynamic Actions Compatibility: Dynamic actions work with custom objects. However, for standard objects, actions are pulled from the record details in the page layout, not from the Dynamic Forms fields on the page.
Also
How to create a custom object within Salesforce
Custom Object VS Record Type