Anda di halaman 1dari 3

Exercise: Adding Default Data Transforms

One of the most common tasks in any application development effort is initializing data objects. In
Pega 7, we use data transforms to accomplish this tasks. No coding is required, and the simple
interface allows any level of developer to complete this task quickly and easily.
In some situations, such as when we create data objects using the Configure form option in the case
designer, a default pair of data transforms pyDefault and pySetFieldDefaults - are created
However, when we create data objects using the Data Explorer (as we have done in this course) or
directly in the Application Explorer, these two key data transforms may need to be created manually.

Role: System Architect

User Name: Admin@SAE

Password: rules

1. Switch to the App Explorer
2. Expand SAE-HRServices-Work and then right-click on Data Model.
3. From the context menu, select Create > Data Transform.

4. Enter .pySetFieldDefaults in the Label field.

Tip: When creating data transforms to initialize data objects, use the default data
transform names pySetFieldDefaults and pyDefault. This allows you to maintain a
consistent format with PRPCs default configuration.

5. Click Edit and change the Identifier to pySetFieldDefaults, and then click OK.

Important: Ensure the Identifier is pySetFieldDefaults, as shown in the image above.

6. Click Create and open.
7. Specify an action to Set the Target .Employee.pyLabel equal to , and then click Save.

Tip: You can use any property defined in the .Employee data object. In our example,
we use .pyLabel because it is the same property used when PRPC creates this data
transform automatically. Using .pyLabel allows us to maintain a consistent format
with PRPC.
8. Refresh the App Explorer to see the new data transform.
9. Using the same procedure as in steps 2 & 3, create another data transform.
10. Enter pyDefault in the Label field, click Edit to change the Identifier to pyDefault and then
click Create and open.

11. Change the Action to Apply Data Transform, set the Target to pySetFieldDefaults, and
then click Save.

12. Refresh the App Explorer to see the new data transform.

Testing the Data Transforms

Test the data transforms to ensure they execute correctly and produce the expected result.
1. Ensure the pyDefault data transform is open in the work area.
2. Click the Actions button in the upper right corner and select Run from the menu. A new
(pop-up) window will open.
3. Click Execute in the new window.
A second pop-up window will open with the results. Most of the elements are related to default
properties set by PRPC, however the Employee data object should appear at the bottom of the list.