--- title: "Copy action" slug: "configure-copy-action-button" description: "Configure a Copy Lightning action to be able to copy existing agreements/quotes. " updated: 2024-05-14T13:42:31Z published: 2024-05-14T13:42:31Z canonical: "docs.zilliant.com/configure-copy-action-button" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.zilliant.com/llms.txt > Use this file to discover all available pages before exploring further. # Configure Copy action You can configure the **Copy** Lightning action and add it to your **Agreement** and **Quote** Lightning record page layouts. This enables users to copy an existing agreement or quote and use the copy as a starting point for a new agreement or quote. When configured, the **Copy** button duplicates the agreement or quote's header information, line items, and sublines in one action. ## Add the Copy action button Add the **Copy** Lightning Action button to the **Highlights Panel** area of the **Agreement** and **Quote** Lightning record page layouts. 1. From an existing **Agreement** or **Quote** page, select **Setup**, then select **Edit Page**. 2. At the top of the central page layout area, select the **Highlights Panel** component to display its properties panel. 3. In the properties panel, scroll down to the **Assign Page Layouts** section, then select the previewed page layout. 4. In the page layout editor, in the palette area, select the **Mobile & Lightning actions** group. 5. Move the **Copy** action button into the **Salesforce Mobile and Lightning Experience Actions** area of the page layout. 6. Select **Save**. The **Copy** action button works by looking for the **Global** copy configuration and the managed copy directive that is associated with the same object as the **Copy** button itself. For example, if you added the **Copy** button to your **Quote** Lightning record page layout, the button is associated with the **zpl_PriceLookup_c** object. When a user selects the **Copy** button on any existing quote, the system looks for the **Global** copy configuration and the managed copy directive named **Simple_PriceLookup_Copy** that is associated with the **zpl_PriceLookup_c** object, and then performs the copy acton as defined by those two custom metadata types. Note Deal Manager managed packages include three default copy directives: - **Simple_Contract_Copy**—**Contract** copy directive that works with the **Copy** button. - **Simple_PriceLookup_Copy**—The **zpl_PriceLookup_c** copy directive that works with the **Copy** button. - **Simple_Deal_Copy**—The **zpl_Deal_c** copy directive that works with the **Copy** button. You can also configure a custom copy directive. For more information, read [Configure custom copy directives](/v1/docs/configure-custom-copy-directive). ## Define the Global copy configuration The **Global** copy configuration specifies which field values must never be copied from any agreement or quote. This could be, for example, **CreatedByID** and **CreatedDate** fields. In the new copy, you want these fields always to be populated with new system values. 1. Go to **Setup > Custom Code > Custom Metadata Types**. 2. On the **Copy Configuration** row, select **Manage Records**. 3. For the **Global** copy configuration, select **Edit**. 4. In the **Copy Exclude Directive JSON** field, specify a single **fieldsToExclude** array that lists all the fields common to the **Contract**, **zpl_PriceLookup_c**, and **zpl_Deal_c** objects that you want to exclude from every **Copy** action. Tip In the following step, you can define additional fields to exclude that are specific to the **Contract**, **zpl_PriceLookup_c**, and **zpl_Deal_c** objects. Do this in the copy directive for each object. #### JSON example for the Global copy configuration ``` { "fieldsToExclude":[ "CreatedById", "CreatedDate", "Id", "LastModifiedById", "LastModifiedDate", "LastReferencedDate", "LastViewedDate", "SystemModstamp" ] } ``` 1. Select **Save**. Important Do not create additional copy configurations. The **Global** copy configuration, which is installed by the **Deal Manager** managed package, must be the only copy configuration in the system. ## Define two copy directives You must have a copy directive for the object that you are attaching the copy control to. These directives, together with the **Global** copy configuration, control what the **Copy** action will do. 1. Go to **Setup > Custom Code > Custom Metadata Types**. 2. For the **Copy Directive** row, select **Manage Records**. 3. For the **Contract** copy directive named **Simple_Contract_Copy**, select **Edit**. 4. In the **Copy Directive JSON** field, specify JSON to control what is copied and whether you want to apply an IQA configuration to the copied result. 5. Select **Save**. 6. Repeat this process for the **zpl_PriceLookup_c** copy directive named **Simple_PriceLookup_Copy** and for the **zpl_Deal_c**copy directive named **Simple_Deal_Copy**. Important - The default pattern for copy directives is to include all fields from the object except for those specified in the **Global** copy configuration (from the previous step). You can add a **fieldsToExclude** property to explicitly declare additional fields to exclude during the copy operation. - You must explicitly declare which **childObjectsToInclude**. If none is specified, only the parent source object is included. - For each child object, you must explicity define the **fieldsToExclude** and can optionally specify additional **childObjectsToInclude** for each child object. For more information about different JSON examples for a single and multiple IQA configurations, read [JSON examples for the Contract copy directive topic](/v1/docs/json-examples-for-the-copy-directives).