You are here: Reference > Activity methods > Page-Copy

  Page-Copy method

Use this method to copy the contents of a source clipboard page to a new or previously created destination clipboard page. The Page-Copy method does not alter the source page.

After this method completes, the destination page contains properties copied from the source page, and can contain additional properties set in a data transform.

Note: Pega does not recommend using Page-Copy with both the source and target being data page instances on the clipboard, as the target data page receives from the source data page values for the properties pzPageNameBase and pzPageNameHash. These properties identify the data page, and having the same values for these properties on two clipboard pages can results in unwanted behavior. To create a clipboard instance of a data page, reference the data page with any parameters required; the data page creates an instance of itself tailored to the specifics of each reference.

Page-Copy involves source and target both as a Data Page, then the resulting Data Page will have its pzPageNameBase and pzPageNameHash values also from the source Data Page. Although, this way of populating a Data Page is not suggested

Parameters

This method has four parameters:

Parameters

Description

CopyFrom

Optional. Enter the name of the source page from which to obtain property values to copy. If blank, the system uses the Step Page of the current step, or the primary page of the activity if the Step Page field is blank.

CopyInto

Enter the name of the destination page, which may or may not already exist. If it exists, it must have the same class as the source page. The current contents of the destination page are erased before the copy operation occurs.

Choose a valid page name. See Understanding page names and reserved pages.

To create a destination page that is a new, last page in a Page List, identify a fully qualified Page List property name and use the <APPEND> keyword as the index.

Data Transform

Optional. Identify a data transform to be applied to the destination page before copying data from the source page.

PageList

Optional. To save the name of the new page as the final element in a list, identify a Value List property (not a Page List property). Use the notation pagename.propertyname.

The system appends the name of the new page as the value of the last element of the Value List property.

Results

The Page-Copy method works as follows:

  1. If the source page cannot be found, the method does not fail. It does not alter any pages. The resulting method status value is Good.
  2. If the destination page (identified in the CopyInto parameter value) does not already exist, the system creates a blank page of the same class as the source page. It can be a top-level page or an embedded page.
  3. If the destination page does exist (and is of the same class as the source page), it is cleared.
  4. If the Data Transform parameter is not blank, the system finds the data transform using rule resolution. It applies the rule to the destination page.
  5. Next, the system copies properties and all messages from the source page into the destination page. This copying can create new properties on the destination page or update the value of existing properties created by the data transform.
  6. During this copy processing, each property is validated against its definition (its Rule-Obj-Property instance). If a property value fails validation, the system adds a message to the destination page.
  7. If a Value List property is identified in the fourth parameter, the system adds the name of the new page as the final element in the list.

Page names are unique within the clipboard. If an existing page with the CopyInto destination name is already present at the same point in the clipboard structure, the system deletes it and replaces it with an empty page.

Checking the method status

This method updates the pxMethodStatus property. See How to test method results using a transition.

Methods and instructions by function