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
A 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 credit card information or their 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 Data Records stored locally in the Pega Database or accessed from an external system of record maintained by the client, or from previously-executed Cases, there are specialized Field Types to account for these use cases, including Data reference and Case reference.
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:
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 those customers selected. An example of the Current customer list of records data relationship is seen in the following image:
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. Assigning the Embedded Data Field Type to a field forces all usage of the field to be in a common format across all Case Types associated with the application. The data captured by a field with an Embedded Data Field Type is stored with the data associated with each specific Case instance. Using the Embedded Data field Type, you can associate an application-level data object with many Case Types, guaranteeing more efficient and consistent data capture across the application.
For example, the supermarket's 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 (pyGUID). 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 placed, 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:
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 and embeds this data into the data associated with that specific Delivery Order Case. When the Case instance is stored, it includes the data associated with the customer's Credit card. The Customer's credit card information is accessible only by retrieving the information associated with that specific 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 from Data Records stored locally in the Pega Database or accessed from an external system of record maintained by the client.
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:
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. To support a workflow where the customer identifies the product they would like to purchase by entering a quantity next to the product information, an Order line data object is created. The Order line data object contains a Quantity field as well as a Order item 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 the goal of the Order line is to capture the quantity of a single Product, the option selected is Single record.
To make the Order line data object available in the Delivery Order Case Type, another data relationship is created. Because the Order 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 the customer is expected to order more than one item, the Option selected is List of records.
The relationship between the Product data object, Order line data object, and Ordered items Embedded Data field are displayed in the following figure:
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.
Want to help us improve this content?