Table of Contents

Article

Using Data Transforms in Flow Actions

With a data transform, you can easily copy, map, and transform clipboard data values from one clipboard page to another. For example, you can set the default value of “Full Time” for the employment type of any new hire. This can be changed in the user interface later, if needed.

You can also use a data transform for updating property values on a page using properties from another existing page. For example, the billing address and shipping address in online purchases are likely the same. A data transform can read property values from one page, such as the billing address, and copy those properties to another page – in this case, to the shipping address.

Records, such as flows, sections, connectors, flow actions, and data transforms, can accept a reference to a data transform.

This article presents a sample Travel application to demonstrate how data transforms can be used in a flow action.

Design requirements

In this example, a trip case is processed in a screenflow, which comprises four assignments. When the user first completes the Traveler Info form and submits it, the system creates the trip and proceeds to the Event form.

TravelerForm.png

The application's business analyst has defined two requirements that must be met when a trip reaches the form.

Requirement 1

The system must create a default event named "Pegaworld 2015" and populate the Event form's four values when the form is rendered, as shown here:

Event1.png

If the user deletes the default event and returns to the Traveler Info form, the event must not be created again. For example, if the user deletes PegaWorld 2015, adds another event, returns to Traveler Info to update the email address, then advances to Event again, the form does not contain the Pegaworld 2015 event.

Requirement 2

Selecting the check box at the beginning of the row in the Event form indicates that a flight and hotel are to be booked for the event. The requirement states that when the user submits the form, the Location, Start Date, and End Date values must be displayed in their respective fields on the Flights form, as shown here:

ActionEventRuntime2.png

How to implement requirements

You implement the requirements in two major steps:

  1. Create two data transforms that do the following:
    • The first transform creates and populates an event on the Event form before it is rendered.
    • The second transform populates the event information entered by the user on the Flight form after submitting the Event form.
  2. Associate the data transforms with the Event flow action.

Step 1. Create two data transforms

Create the following data transform records in the Trip case type. In this example, the four properties on the Event form (Event, Start Date, End Date, and Location) are in a page list named Event, which refers to a data page named D_EventList.

Create the PopulateEvent transform

The Definition tab on the data transform is configured as shown here.

DataTransformPopulateEvent_0.png

Rows 1 and 1.1 state that the transform runs only when the select event is accessed for the first time and there are no events defined.

When run, the results of D_EventList set the values on the case work page. For example, when the user advances to the Events form and the transform runs, the data page on the Clipboard looks like this:

clipboard0.png

The case's work page contains the values set by the transform.

clipboard1.png

Create the SetEventDetails transform

The Definition tab on the data transform record is configured as shown here:

DataTransformSetEventDetails_0.png

As shown in row 1.1, when the check box is selected (pySelected==true), the transform sets the Destination, EndDate, and StartDate values on the Flights form using the values on the case's work page.

Step 2. Add the transforms to the Enter Trip Information flow action

In the Enter Trip Information flow action (which renders the Event form) on the Action tab, do the following:

  1. Enter transform PopulateEvent in the Pre-Processing section, which is invoked before the system renders the Event form.
  2. Enter ​transform SetEventDetails in the Post-Processing section, which is invoked before the system renders the Flights form.

The completed tab looks like this:

EventFArecord1.png

Published February 11, 2015 — Updated February 19, 2015


90% found this useful

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.