Pega Constellation: Save Data to a Data Type (Full Beginner Guide)

Welcome back! In today’s tutorial, we will continue building our application. Specifically, we will:

  • Create an optional action to allow users to add a new customer
  • Configure the UI to capture customer information
  • Save the data into a data type and create a new record in the database
  • Fix common mistakes and review troubleshooting tips

Let’s get started.


1. Creating the Optional Action

So far, we have only built our Customer Search feature. Now we want users to have the option to create a new customer if the search doesn’t return a result.

To create an optional action:

  1. Go to the Case Life Cycle panel on the left side.
  2. On the right panel, find Optional Actions.
  3. You can add:
    • A single-step form
    • A multi-step form
    • A process

For this tutorial, I created a process that includes a form for entering new customer details.


2. Creating the Flow Action and UI Section

Inside the optional action process, we created a flow action, and inside that flow action we added a section that contains the customer fields.

I kept the form simple with just a few fields so it’s not too cluttered. The values entered here will be used to create a new customer record in the database.


3. Preparing the Data Structure

To save data into a data type, Pega requires a single page property mapped to the class of your data type.

You can create this by navigating to:

App Explorer → Data Model → Property → New Property

  • Set the property type to Page
  • In Page Definition, enter the class of your customer data type

We will use this single page later in our save operation.


4. Using the “Save Data Page” Automation Shape

Initially, I mistakenly selected Load Data Page, but for saving we need the Save Data Page automation shape.

To configure it:

  1. In the flow, remove the incorrect shape (if needed).
  2. Add Save Data Page from the Automation palette.
  3. Open the shape and choose the page property associated with your data type.
  4. Select the identifier that will be used as the record key (e.g., CustomerID).

5. Creating the Data Transform (Mapping Values)

We now need a Data Transform to map values from the UI into the data page before saving them.

Steps:

  1. Create a new Data Transform (e.g., CreateNewCustomer).
  2. Generate a unique key using:
    @pxGenerateUniqueID()
    This will populate the record ID automatically.
  3. Map all the form fields (source) to the customer data type properties (target).
  4. Save the rule.

6. Testing the Flow (First Attempt)

At this point, I tested the functionality, but noticed an issue:
The optional action wasn’t appearing in the case.

This happened because I was using the UI Kit theme, which lacks certain newer UI features.


7. Switching the Application Theme to Cosmos

To fix that:

  1. Open the Application rule.
  2. Change the UI theme to Theme-Cosmos (latest version).
  3. Save the rule.
  4. Open the Skin rule and change inheritance to a Cosmos skin.
  5. Save and log back in.

Now the optional actions show correctly in the portal.


8. Fixing the Optional Action Label

Inside the flow action rule, update the Label to something meaningful like Create New Customer.

Refresh the portal, and the new label appears.


9. Saving the New Customer Record

Enter the customer details in the optional action form and click Submit.

Initially, I made another mistake—trying to create a separate property and link it manually.
The correct approach is:

  1. Use a savable data page
  2. Set the Data Source to a Data Transform
  3. Map properties from pyWorkPage to the data type
  4. Generate the ID in the Data Transform

10. Correct Savable Data Page Setup

A proper configuration includes:

Data Page

  • Structure: Page
  • Scope: Thread
  • Data Source: Data Transform
  • Parameters: Include the record ID (e.g., CustomerID)

Data Transform

  • Add pyWorkPage under Pages and Classes
  • Map:
    • Form fields → Data type properties
    • Auto-generated ID → Identifier property

Once saved, this Data Page can be invoked:

  • From a flow action (post-processing)
    or
  • From a Save Data Page automation shape

Both work.


11. Testing the Final Working Configuration

  1. Create a new case.
  2. Open Create New Customer.
  3. Enter the information.
  4. Submit the form.

Open your data type, click Records, and you will see the new row created successfully.

This confirms that:

  • The Data Transform ran correctly
  • The savable data page executed
  • The database updated without errors

12. Troubleshooting Tips

  • Use the Clipboard to inspect the data page and verify that:
    • Parameters were passed
    • No errors occurred
    • The record key was generated
  • Check Pages & Classes if a Data Transform can’t resolve properties
  • Ensure the savable data page’s Data Source is set to Data Transform, not connector
  • If optional actions don’t appear, verify the UI theme is Cosmos

Final Thoughts

This tutorial covered:

  • Creating optional actions
  • Designing a form to collect customer information
  • Configuring a savable data page
  • Mapping data using a data transform
  • Saving a new record into a data type
  • Troubleshooting common issues

I hope this helps you better understand how to manage and save data into Pega data types.
Check out my blog (linked in the video description) for a more detailed, step-by-step guide.

Thanks for watching, and see you in the next tutorial!

Leave a Reply

Hello World


Welcome! This blog was created to share a practical, hands-on Pega tutorial. Instead of focusing on theory, we’ll walk step-by-step through building an application from scratch. Along the way, you’ll work directly with the platform and explore the core rules and concepts covered in the CSA and CSSA courses.

If you’re looking to truly understand how to use Pega and strengthen your skills through real practice, you’re in the right place. I hope you enjoy the journey!

Let’s connect

Discover more from Pega Sandbox

Subscribe now to keep reading and get access to the full archive.

Continue reading