Configure Copy action
  • 14 May 2024
  • 3 Minutes to read
  • Dark
    Light

Configure Copy action

  • Dark
    Light

Article summary

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_CopyContract 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.

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_ccopy 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.


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.