Skip to main content

Creating data relationships

In a Pega Platform™, each data object in an application is available for use by all of the Case Types in that application. Data objects are made available to Case Types through data relationships.

In this topic, you explore the concept of data relationships, and how they make the information associated with a data object accessible to a Case Type.

Data relationships

data relationship is a container in which you associate a set of related fields. Unlike a data object or a field that stores data, a data relationship does not store data. Rather, a data relationship acts to relate data between the elements of your application that do store data and the elements of your application that need that data to successfully resolve a Case.

Data relationships are used to relate data between data objects and a Case Type, between data objects, and between Case Types.

Data relationship Field Types

Because there are many different use cases for data relationships, there are several Field Types to support different configurations. The following table displays the different Field Types associated with data relationships:

Data relationship Field Type Data source Use case
Embedded Data Information is input or selected by an application's user directly into the Case. A company needs to capture a user's new shipping address.
Data reference

Information is sourced from Data Records stored locally in the Pega database or from information retrieved from an external system of record.

An online retail organization provides a list of available items, sourced from their company database.
Case reference Information is sourced from a selected Case Type. A user selects from a list of Service Cases from the Service Case Type.

Consider where the values associated with the data object are sourced when determining what Field Type to use.

An Embedded Data Field Type is used when data is sourced from user input or a user action that is made directly inside a Case instance.

If the data object is sourced from outside of the Case, either from locally stored Data Records, an external data source, or other Cases, there are specialized Field Types to account for these use cases, including Data reference and Case reference. 

Of the three data relationship Field Types, Embedded Data and Data reference are used most commonly. 

Single record or list of records data relationships

Regardless of the Field Type used to define the data relationship, data relationships are configured to reference either a single record or multiple records

A single record data relationship references a situation where only a single set of fields and values from a data object are used to resolve a Case. An example of a single record relationship is a Customer record, as shown in the following image:

customerField

A list of records data relationship references a situation where a list of grouped fields and values from a data object are used for Case resolution. An example of a list of records data relationship is a list of current customers, where a record is included for each customer. An example of the Current customer list of records data relationship is seen in the following image:

Current customers multiple-record data relationship

Check your knowledge with the following interaction:

To facilitate your understanding of data relationships, consider three common scenarios using examples from a supermarket's Online Order application. The application uses data relationships to relate data objects to the Delivery Order Case Type.

Embedded Data relationship

An Embedded Data Field Type is used when data is sourced from user input or a user action that is made directly inside a Case instance. The data in an Embedded Data Field Type is stored within a Case instance instead of sharing a data source. It forces all usage of the field to be in a common format across the application. By reusing data objects to create Embedded Data fields, you guarantee more consistent data in an efficient manner. However, the data is not stored outside the Case to be easily shared across Cases and Case Types.

For example, the Online Order application includes a Credit card data object. The Credit card data object includes the Card type, Card number, Expiration date, and a uniquely-assigned Pega ID field.  Business requirements for the Delivery Order Case Type's MLP1 indicate that the customer placing the order must enter their payment information every time an order is place, and that the information for only one credit card can be used to pay for the order.

Because the user is supplying the data directly in the Case instance, the Credit card data object is related to the Order Case Type in a field called Payment information with an Embedded Data Field Type. Because the information for only one credit card can be entered for each order, the Single record option is selected. The Credit card data object and Payment information Embedded Data field are displayed in the following figure: 

The Credit card data object added as Embedded Data field in Delivery Order Case Type

By creating the Payment information data relationship, the Delivery Order Case Type has access to all of the fields associated with the Credit card data object.

When a user interacts with a Delivery Order Case, their Task is to enter data for their credit card, specifically the card type, card number and expiration date. The Credit card data object retains the information that the user enters plus a uniquely-assigned Pega ID value and writes that information in the Pega database. When the Case instance is stored, it includes a reference to the Credit card record by using its unique key, along with other metadata and field values associated with the Case. 

Data Reference data relationship

Case processing often requires access to data sourced from outside of the Case. A Data reference data relationship is used when the data needed in a Case is sourced either from locally stored Data Records or data accessed from an external system of record.

For example, the Online Order application includes a Customer data object. The Customer data object includes the First name, Last nameFull nameEmail, and Phone fields. Information related to the Customer data object's First name, Last nameFull nameEmail, and Phone is stored in an external system of record maintained by the supermarket's IT department. Because each Delivery order Case is associated with only one customer, the Single record Option is selected. The Customer data object and Ordering customer data reference field are displayed in the following figure: 

The Customer data object added as a Data reference field in Delivery Order Case Type

By creating the Ordering customer data relationship, the Delivery Order Case Type has access to all of the fields and data values associated with the Customer data object. 

Data relationships between data objects

In addition to making the fields and data values associated with a data object available in a Case Type through a data relationship, data relationships also make it possible to reference one data object inside another data object.

For example, creating an online delivery order requires the Case Type to display a list of available products. The Product data object includes the Name, Description, Price per unit, and SKU fields. The Product data object is sourced from an external database maintained by the supermarket's IT department. The customer identifies the products they would like to purchase by entering a quantity next to the product information. To support this workflow, a Product line data object is created. The Product line data object contains a Quantity field as well as a Products field that is a data relationship with the Product data object. Because the Product data object is sourced from an external system of record, the Field Type of the data relationship is Data reference. Because it contains a list of information, the Option selected is List of records. The Product line data object, Product data object, and Ordered items Embedded Data field are displayed in the following figure:

The Product data object reference in the Product Line data object.

To make the Product line data object available in the Delivery Order Case Type, a data relationship is created. Because the Product line data object requires users to enter a number into the Quantity field, the Ordered products data relationship is given an Embedded Data Field Type. Because users receive a list of products from which to order, the Option selected is List of records.

Check your knowledge with your following interaction:


This Topic is available in the following Module:

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice