Re-render only the related list after a custom action runs, so the rest of the form keeps its unsaved values and the user does not lose their scroll position.
- Identify the component to re-render
Wrap the section you want to refresh inside an apex:outputPanel with a stable id attribute (id="rl"). This is the panel the rerender attribute will target.
- Add an apex:actionRegion
Wrap the form fields the partial action depends on inside an apex:actionRegion. Fields outside the region are excluded from the postback and their validation does not fire.
- Place the command button
Add an apex:commandButton with action pointing to the controller method and rerender pointing to the panel id (rerender="rl").
- Test the round-trip
Run the page. Type into a field outside the action region. Click the partial-action button. Confirm the panel re-renders, the field outside the region keeps its value, and the user sees no full-page flash.
- Validate scoped validation
Add a required field outside the region. Click the partial-action button without filling it. The button should still execute; the required field validation only fires on the full save.
- Optimize View State
Mark any controller variable that does not need to persist across postbacks as transient. Run the View State inspector to confirm the page stays under 170 KB.
Wrapper that gets a stable ID for the rerender attribute to target.
Scope that limits which form fields post and which validation rules fire.
Comma-separated list of component IDs to refresh after the action.
JavaScript-callable server action; pairs with rerender for client-driven partial updates.
- The rerender attribute must reference a component ID that exists at the time the postback returns. A component conditionally rendered out (rendered="false") cannot be re-rendered back in; use display:none CSS to keep the DOM node available.
- Partial postbacks still serialize the full View State. They are not a View State optimization; they are a user-experience optimization.
- Action regions limit which fields post. Forgetting to wrap a dependent field can leave the controller looking at a stale value the partial action did not include.
- Lightning Web Components do not use partial-page techniques; do not port these patterns when migrating a Visualforce page to LWC, refactor to reactive data binding instead.