# Duplicate objects

The Duplicate objects action node creates copies of objects and stores them in a [runtime-only data source](https://docs.appfarm.io/reference/apps/data/data-sources#database-connected-and-runtime-only-data-sources).

## Usage

This action node is used when there is an existing object containing data and that data needs to be copied into a new object.

Each time an object is duplicated, a new object is created with a new **ID** and the appropriate **Created Date** and **Created By** values. All other object class properties values are copied to the new object, but each can be overridden. The object being duplicated is available as the [object in context](https://docs.appfarm.io/reference/platform-concepts/objects#object-in-context).

### Example

{% tabs %}
{% tab title="Duplicate a project" %}
Your app is used to manage projects and you'd like to be able to easily create a new project by copying an existing project.

Use Duplicate objects to create a new project object in a runtime-only data source based on the selected existing project. Under **Values for override**, set any values that should be specific to this new project, such as the project number.

To store the new project in the database, use [Persist objects](https://docs.appfarm.io/library/action-nodes/persist-objects).
{% endtab %}
{% endtabs %}

## Properties

<table><thead><tr><th width="244">Property</th><th>Description</th></tr></thead><tbody><tr><td><strong>Data Source</strong></td><td>Select a runtime-only data source to store the newly created duplicate object(s).</td></tr><tr><td><strong>Replace Existing Objects</strong></td><td>Remove any existing objects in the selected <strong>Data Source</strong> before the new objects are created.</td></tr><tr><td><strong>Set Selected</strong></td><td><em>Available if the selected</em> <strong>Data Source</strong> <em>is a many-cardinality data source.</em><br><br>Set the newly created objects as <a href="../../../reference/platform-concepts/objects#object-selection">selected</a>.</td></tr><tr><td><strong>From Data Source</strong></td><td>Select the data source containing the original object(s) to duplicate.</td></tr><tr><td><strong>Mode</strong></td><td><em>Available when used in app actions.</em><br><br>Options:<br><br><strong>Duplicate from database (default).</strong> Will duplicate all values of the object from the database, including those not available on the client. This will not overwrite any runtime values that are already present on the client. Note: can not be used in offline mode.<br><br><strong>Duplicate client values.</strong> Will only duplicate values available on the client.<br><br>Read more about how data is loaded into the client <a href="../../../how-to/security-testing-and-deployment/optimize-your-app#how-data-is-loaded-in-apps">here</a>.</td></tr><tr><td><strong>Selection</strong></td><td><p><em>Available if the selected</em> <strong>Data Source</strong> <em>is a many-cardinality data source.</em><br><br>Define the objects to duplicate.</p><ul><li><code>All objects</code></li><li><a href="../../../reference/platform-concepts/objects#object-selection"><code>Selected object(s)</code></a></li><li><a href="../../../reference/platform-concepts/objects#object-in-context"><code>Object in context</code></a></li><li><code>Filtered selection</code></li></ul></td></tr><tr><td><strong>Filter</strong></td><td><em>Available when</em> <strong>Selection</strong> <em>is Filtered selection.</em><br><br>Define the <a href="../../reference/platform-concepts/filters">filter</a> to apply to the data source.</td></tr><tr><td><strong>Sorting</strong></td><td><em>Available for all</em> <strong>Selection</strong> <em>options except Object in context.</em><br><br>Add <a href="../sort-objects#sorting">sorting rules</a>.</td></tr><tr><td><strong>Values for override</strong></td><td>Set new values for any object class properties in the duplicate object(s).</td></tr></tbody></table>
