> For the complete documentation index, see [llms.txt](https://docs.avonnicomponents.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avonnicomponents.com/dynamic-components/component-builder/interactions/duplicate-record.md).

# Duplicate Record

The Duplicate Record interaction clones an existing Salesforce record directly from your Dynamic Component.

## Overview

The Duplicate Record interaction creates a copy of an existing Salesforce record directly from your Dynamic Component. Use it when you need to clone a record — and optionally modify the copy afterward — without asking the user to re-enter data.

You can identify the record to duplicate in three ways: from a Record Variable, from the record the user is currently viewing, or by entering a record ID manually.

***

## Configuration

To duplicate a record, you must tell the interaction which record to copy.

### Method 1: Duplicating a Record Variable

Use this method when the record to clone is already held in a Record Variable (e.g., populated by a Get Record interaction or selected from a list).

* Add an On Click interaction to the triggering component (e.g., a "Duplicate" button).
* Action Type: Select `Duplicate Record`.
* Record Variable: Select the variable holding the record you want to duplicate (e.g., `{!selectedContact}`). The variable must be defined as a resource in your Dynamic Component.

### Method 2: Duplicating the Current Page Record

Use this method when your component is placed on a Record Page (e.g., an Opportunity page) and you want to clone the record currently being viewed.

* Add an On Click interaction.
* Action Type: Select `Duplicate Record`.
* Record Variable: Select Target Page Record.

### Method 3: Entering a Record ID Manually

Use this method when the record ID comes from somewhere else — a formula, a component attribute, or a static value.

* Add an On Click interaction.
* Action Type: Select `Duplicate Record`.
* Record Variable: Select Enter record ID manually.
* Record ID: Provide the Salesforce record ID to duplicate. This can be a static ID or a merge expression (e.g., `{!Datatable1.selectedRowKeyValue}`).

### Post-Action Configuration

The Duplicate Record interaction lets you chain follow-up interactions depending on the outcome:

* **On Success**: The interactions to execute when the record is duplicated successfully. It is recommended to add a [**Refresh All Queries**](/dynamic-components/component-builder/interactions/refresh-all-queries.md) interaction so the new copy appears in your lists immediately, plus a [**Show Toast**](/dynamic-components/component-builder/interactions/show-toast.md) (Success variant) to confirm the action.
* **On Error**: The interactions to execute when the duplication fails. Add a [**Show Toast**](/dynamic-components/component-builder/interactions/show-toast.md) with the "Error" variant so the user isn't left with a silent failure.

Accepted follow-up interactions for both outcomes are: [Show Toast](/dynamic-components/component-builder/interactions/show-toast.md), [Refresh All Queries](/dynamic-components/component-builder/interactions/refresh-all-queries.md), [Refresh Query](/dynamic-components/component-builder/interactions/refresh-query.md), [Get Record](/dynamic-components/component-builder/interactions/get-record.md), and [Assignment](/dynamic-components/component-builder/interactions/assignment.md).

***

## Example

Goal: Let users create a new project record based on an existing "template" project.

1. Data Table: Display Project records with a row action labeled "Clone".
2. Interaction: On the row action, add a Duplicate Record interaction using Enter record ID manually with the row's record ID.
3. On Success: Chain Refresh All Queries (so the copy shows up in the table) and Show Toast ("Project duplicated successfully").
4. On Error: Chain Show Toast with the Error variant.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.avonnicomponents.com/dynamic-components/component-builder/interactions/duplicate-record.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
