Skip to main content

Dynamic Rows

Explore practical guides and implementation patterns for this topic.

Posts

Apex Development

How to Add and Remove Multiple Parent and Child Records Dynamically in Salesforce

While Lightning Web Components (LWC) are the modern standard for Salesforce UI development, thousands of organizations still maintain and build upon complex Visualforce pages for internal data-entry tools. One of the most common—and challenging—requirements is creating a single, unified screen where users can dynamically add multiple parent records (like Accounts) and multiple child records (like Contacts) at the same time before hitting save. In plain words: To let users click an "Add Row" button for both parent and child records on a single Visualforce page, you must use "nested wrapper classes" in your Apex controller. These wrappers tie the records together in the server's memory, so when the user adds or deletes a specific row, Salesforce knows exactly which data to update without losing their inputs.
Read article