Skip to main content

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. Consider where the values associated with the data object are sourced when determining what Field Type to use.

The following table displays the different Field Types associated with data relationships:

Data relationship Field Type Data source Use case
Embedded Data Use this field when information is collected from user input into a Case. Capture information about the emergency contact for a patient, and then store the details about the contact in the patient record.
Data reference

Use this field when you need to reuse another data object from outside the Case.

Use this field in a Case Type for booking medical appointments, to reference the facility where the appointment is made.
Case reference Use this field when you want to reuse data from another Case. A user selects from a list of service Cases from the Service Case Type.
Query Use this field for read-only access to information that is external to the Case. The Query Field Type allows parameters to query for specific data. Return the next appointment for a medical professional or the list of all appointments they have in a given time frame.

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

Single or list of record(s) data relationships

Regardless of the Field Type used to define the data relationship, data relationships are configured to reference either a single record or list of 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 records are 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:

Detailed use cases

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 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 name, Full name, Email, and Phone fields. Information related to the Customer data object's First name, Last name, Full name, Email, 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 the following interaction:


This Topic is available in the following Modules:

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