--- title: "Copy instance" slug: "core-copy-instance-resolver" updated: 2026-04-23T09:14:07Z published: 2026-04-23T09:14:07Z canonical: "docs.lobstersoftware.com/core-copy-instance-resolver" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # Copy instance *See also:* [Create instance](/v1/docs/en/core-create-instance-resolver) > [!NOTE] > **Value resolver – Abstract** > > **Purpose:** Creates a copy of the object present as *input value* and returns it as return value. > > > [!TIP] > > Tooltip > > > > - **Usage**: The original to be copied is expected as *input value*. The data of the copy is returned. If the *input value* is an entity, the values of properties for entity attributes ("ID", "Owner", "Creator", "Creation date", etc.) are not copied, similarly to interactive copying. > > - **NOTE:** By default, when copying an entity, no "Owner" is assigned to the copy. If the copy is saved without an explicit "Owner" assignment, the [Company of session](/v1/docs/en/base-session-company-account-value) is automatically assigned as the "Owner". ![images/download/attachments/62856999/image2022-10-10_17-52-15-version-1-modificationdate-1665417135621-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2022-10-10_17-52-15-version-1-modificationdate-1665417135621-api-v2.png) The [Copy instance](/v1/docs/en/core-copy-instance-resolver) value resolver creates a copy of the object present as *input value* and returns it as return value. If the *input value* is an entity of a standalone entity type, then copying the instance is equivalent to clicking "Copy" in an interactive context (see [Input forms](/v1/docs/en/base-entity-form)). However, the "Copy" event (see [Common action event](/v1/docs/en/core-common-action-event)) is not triggered. However, copies of non-independent entity types (e.g., inner entities) can also be created, as the second example below demonstrates. - The values of *entity attribute* properties ("ID", "Owner", "Creator", "Creation date", etc.) are not copied, as in interactive copying. - When the transaction to "Create" the copied entity is completed, these properties are automatically populated. **IMPORTANT:** For a copied entity, the [Company of session](/v1/docs/en/base-session-company-account-value) is the "Owner" (`ownerId`) by default and not the "Owner" of the original! This must therefore be explicitly assigned if required (see first example below). - Furthermore, as far as applicable in the context of the entity, the following characteristics or relationships of an entity are not copied either: - [Working state](/v1/docs/en/base-working-states) (current working state, working state history). - [Tracking state](/v1/docs/en/tracking-state-1) (current tracking state attributes, tracking state history). - Assignment of [Tags](/v1/docs/en/core-tag). - Assignment of [Association criteria](/v1/docs/en/core-association-criteria). **NOTE:** The copy created by an entity is volatile, so it must be explicitly persisted when needed, e.g. by pressing "Save" in an input form or by executing the [Save changes later](/v1/docs/en/core-merge-later-once-actor) event action in an event handler. - In [Event handling](/v1/docs/en/administration-designer-workflow-action-event-handler-configuration), a *volatile* *copy* of an entity can be flagged for saving at transaction completion using the [Execute with](/v1/docs/en/core-with-actor) and [Save changes later](/v1/docs/en/core-merge-later-once-actor) event actions. If required, the [Fill primary key](/v1/docs/en/core-fill-primary-key-actor) event action can also be executed in advance to obtain an ID for the entity from the server. - A [Client Workflow](/v1/docs/en/frebehav-client-workflow) can create a *volatile copy* of an entity, for example, to assign its data to a form element or embedded form via [Populate element data](/v1/docs/en/freaction-populate-data). Even then, the *volatile entity* is persisted only if it is explicitly saved afterwards. ## Configuration The original to be copied is expected as *input value*. The value resolver does not use any parameters. ## Examples ### Simple use case: Duplicating an entity In the context of a Custom overview (see [Custom overviews](/v1/docs/en/administration-designer-client-preferences-overview)) a ribbon button is offered for certain entity types to "duplicate" a single entity selected in the list. Detail requirements: - If the [Company of session](/v1/docs/en/base-session-company-account-value) is not the "owner" of the selected original, the user should be able to choose whether "their company" (the [Company of session](/v1/docs/en/base-session-company-account-value)) or the "owner" of the original should be the "owner" of the copy. - The "Duplicate", i.e. the copy of the selected entity, should be saved automatically immediately after copying. - The selection should remain on the original so that further copies of the original can be made immediately. Configuration: > [!WARNING] > **IMPORTANT:** > > The copy can only be created if the [Role of session](/v1/docs/en/base-session-role-value) has the appropriate permissions. Furthermore, the copy can only be assigned a different "owner" from the [Company of session](/v1/docs/en/base-session-company-account-value) if this is permitted. This may require the establishment of [Company authorizations](/v1/docs/en/base-company-release) for all relevant entity types. Alternatively, a [Run as](/v1/docs/en/base-run-as-actor) event action could be used in the following event handling to temporarily claim a role as [Role of session](/v1/docs/en/base-session-role-value) for which ownership restrictions do not apply (e.g., "Super user"). The configuration shown does not do this. | For "Duplicate" (`DUPLICATE`), a [Custom action event](/v1/docs/en/core-custom-action-events) is added and localized in the relevant dynamic enumeration. The event handling shown on the right refers to this under **Triggering events**. --- The **Validating rule** uses [Check type](/v1/docs/en/core-check-type-rule) to ensure that the event was executed in the context of an "Entity". Since the "Entity" class is checked for all entity types, the same event handling can be used for any entities. Whether [Custom overviews](/v1/docs/en/administration-designer-client-preferences-overview) support duplication or not for a specific entity type is to be controlled here only by the configuration and assignment of the ribbon macro. --- As an **Action on passed rule**, an [Execute with](/v1/docs/en/core-with-actor) event action is executed: - Since data of the original and the copy must be accessed in the *action block*, the **Save entity in variable** parameter stores a reference to the original in the `original` variable. - In the **Object Resolver** parameter, the [Copy instance](/v1/docs/en/core-copy-instance-resolver) value resolver is used to obtain the – initially volatile – copy of the entity from the *input value* as an *alternative* *reference object* for the event actions in the *action block*. - The *action block* provides the following operations: - Within an [If then else](/v1/docs/en/core-if-then-else-actor) event action, first the "owner" (`ownerId` property) of the original entity (in the original variable) is compared with the "ID" (`id`) property of the [Company of session](/v1/docs/en/base-session-company-account-value). - Only if there are different owners, the following [User callback](/v1/docs/en/core-user-callback-actor) is executed in the *then*-branch. The user should confirm (via the "Yes" button) that the "owner" of the original should also apply to the copy or reject this (via the "No" button). Then no "owner" is assigned to the copy, so when it is saved, the [Company of session](/v1/docs/en/base-session-company-account-value) is automatically assigned as the "owner". Details of this event action are shown in the screenshot below: - There you can see the – statically assigned texts for **Title** and **Text** in the query dialog. - The [Set value](/v1/docs/en/core-set-value-actor) event action in the **Yes** branch of the case distinction defines the non-standard procedure that the "owner" of the original should be transferred to the copy. - Regardless of whether the [User callback](/v1/docs/en/core-user-callback-actor) is executed and how it is answered, if applicable, the [Save changes later](/v1/docs/en/core-merge-later-once-actor) event action ensures that the entity created as a copy is saved upon successful completion of the transaction. | ![images/download/attachments/62856999/image2022-10-10_17-57-26-version-1-modificationdate-1665417446656-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2022-10-10_17-57-26-version-1-modificationdate-1665417446656-api-v2.png) | | --- | --- | | ![images/download/attachments/62856999/image2022-10-10_17-59-45-version-1-modificationdate-1665417585855-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2022-10-10_17-59-45-version-1-modificationdate-1665417585855-api-v2.png) | ### Use case in client workflow: Duplicate instance of a "Repeatable entity" A *custom type definition* (see [Custom type definitions](/v1/docs/en/custom-custom-type-definition)) for an "Aircraft" (`Aircraft`) entity type contains a "Loading areas" (`areas`)property of the "Repeatable entity" type that lists *inner entities* of the "Loading area" (`LoadingArea`) type. A variety of details can be specified for each loading area. If an aircraft has several identical or at least similarly specified "loading areas", it is possible to duplicate an existing definition for a "loading area" at the push of a button in order to simplify data maintenance. The copy is attached to the existing list in the "loading areas" (`areas`) property. **CAUTION****:** The relationship between an *inner entity* (*here*: loading area) and the parent entity (*here*: "Aircraft") is established when the *parent entity* is saved by assigning the `id` of the *parent entity* to the `parentId` property of the *inner entity*. As an *entity attribute*, the `parentId` property is not transferred from the original to the copied instance. Therefore, saving the parent entity after copying an *inner entity* is essential for the lasting success of the operation. Saving an *inner entity* through a [Save changes later](/v1/docs/en/core-merge-later-once-actor) event action, while technically feasible, as long as it points to a valid `parentId`. However, it is essential to avoid this approach, as it undermines the data sovereignty of the *parent entity* with respect to its *inner entities*, which may compromise data integrity and consistency (including with respect to change history). Runtime example: | *Before:* ![images/download/attachments/62856999/image2022-10-10_18-2-46-version-1-modificationdate-1665417766455-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2022-10-10_18-2-46-version-1-modificationdate-1665417766455-api-v2.png) - The specifications for a **Loading area** `CENTER/L` were created in the [Expandable](/v1/docs/en/fre-expandable-vo) element "Details" (collapsed in the image). - By clicking on the "Duplicate" [Button](/v1/docs/en/fre-button-vo), another "Loading area" is added, for which the same "Details" apply (see image on the right). **NOTE:** Instead, clicking on the ![images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/add.svg](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/add(56).svg) icon would add a new loading area again (and without details). | *After:* ![images/download/attachments/62856999/image2022-10-10_18-3-28-version-1-modificationdate-1665417808510-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2022-10-10_18-3-28-version-1-modificationdate-1665417808510-api-v2.png) - The duplicated loading area has already been renamed `CENTER/R` in the image. The "Details" collapsed in the image are still identical to the original (`CENTER/L`). | | --- | --- | Configuration: | Clicking the button (see [Button](/v1/docs/en/fre-button-vo)) triggers a behavior of the [Client Workflow](/v1/docs/en/frebehav-client-workflow) type. On the one hand, it receives the volatile data of the "Aircraft" entity displayed in the entry form as *input value*. Since the button is located in the repeatable element (here: [Row layout](/v1/docs/en/fre-element-container-vo-row-layout) element) for "Loading areas", the data of the "Loading area" instance to be duplicated can additionally be passed per `original` parameter. The [Client Workflow](/v1/docs/en/frebehav-client-workflow) can be configured on this basis as shown on the right: - The **Validating rule** declares via [Check type](/v1/docs/en/core-check-type-rule), that an entity of the "Aircraft" (`Aircraft`) type is expected as input value. - A [Modify list](/v1/docs/en/core-modify-collection-actor) event action is configured as the only **Action on passed rule**. - On the left side, the [Object property](/v1/docs/en/core-property-resolver) value resolver defines the list to be modified, in this case the list in the "Loading areas" (`areas`) property of the aircraft. - On the right side, the data of the entry to be added must be provided: - A [Variable](/v1/docs/en/core-storage-value) value resolver returns the data of the "Loading area" to be duplicated, defined as `original` when it is called via the [Client Workflow](/v1/docs/en/frebehav-client-workflow) parameter. - The concatenated [Copy instance](/v1/docs/en/core-copy-instance-resolver) value resolver uses this to create a copy that reflects all of the features of the original that can be considered a "payload". | ![images/download/attachments/62856999/image2022-10-10_18-5-15-version-1-modificationdate-1665417916150-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2022-10-10_18-5-15-version-1-modificationdate-1665417916150-api-v2.png) | | --- | --- |