Loading

Create Lightning Custom button to clone and edit the newly created record

Udgivelsesdato: Jun 24, 2026
Beskrivelse

In Salesforce Classic, cloning a record and editing specific fields on the clone using a Custom Button is achieved by passing field IDs and new values in the button URL. In Salesforce Lightning Experience, this functionality is not available out of the box. A custom Lightning Web Component (LWC) or Aura Component is required to replicate this behavior.

Løsning

Custom Lightning Component Approach

There is no direct out-of-the-box functionality to clone a record and immediately edit it using a Custom Button or Quick Action in Lightning Experience. The following approach uses an Aura Component to achieve this via customization.

Implementation Steps

  1. Create a Lightning (Aura) Component that opens any record the agent wishes to clone. Use the force:hasRecordId interface to enable the component to receive the ID of the current record.
  2. In the component controller, use force:hasRecordId to obtain the record ID and create the business logic to clone the record and apply the necessary field value changes.
  3. Display the modified values in a component view, screen, or modal pop-up with Save and Cancel buttons.
  4. Create a Quick Action that calls this Lightning component.

For an example of making a component context-aware, review the Trailhead: Override Standard Actions module.
Note: Consider using Lightning Web Components (LWC) for new development as Aura Components are in maintenance mode.

Vidensartikelnummer

000384654

 
Indlæser
Salesforce Help | Article