Data types in the application data model
To process cases, Pega Platform™ applications use many different data types, which are collections of case data. Data types provide a way for developers to group a set of fields to describe a single object.
For example, an HR application for processing new candidates has the New Candidate case type. To process a new candidate, HR must gather basic information about the candidate, such as their employment history and criminal record information. You can describe a job candidate with a set of fields, including name, email address, home address, and telephone number. The Candidate data type groups these fields to describe the candidate. Similarly, the New Candidate case type has the Employment History data type and the Background Check data type to describe the candidate's employment history and criminal record information.
The collection of case types and data types in your application holistically defines your data model.
Data type structure
A data type consists of one or more single-value fields, lists, or groups of fields. The fields define the data structure of the data type. Collectively, the different fields represent a single type of object. For example, the Candidate data type might have 30 fields, including First Name, Last Name, Address, Email, and Phone Number.
In addition to grouping data elements, data types can group other objects, such as views and other rules that are created by more advanced developers.
Data types can reference other data types. For example, the Candidate data type could have the Address field group that is defined in the Address data type. The Address field group might have such fields as Street Name, City, and Postal Code.
Note: For more information about fields and field groups, see Adding a single-value field to a form and Adding a field group to a form.
Data types are templates that you can use anywhere in your application. For example, an application might contain the generic Account data type that you can reuse in two case types: one that allows the customer to transfer funds between bank accounts, and one that allows the customer to change the address that is associated with their account. Fields that apply across different case types include Account Number, Current Balance, and Next Statement Date, and are saved to the Account data type. Fields that are specific to each case type are saved to the appropriate specialized data types.
Data type inheritance
You can create data types to reuse assets from an existing data type through inheritance. For example, Person is a generic data type, or a parent data type, while Customer and Call Center Representative (CCR) are more specialized data types. To denote the relationship between parent and child data types, use the Parent-Child pattern, for example, Person-Customer and Person-CCR. All three data types have common fields, including Name, Telephone, and Email. By creating the common fields in the Person data type, you can reuse the fields in the Customer and Call Center Representatives data types. The fields Tax Identification Number and Membership Number apply to customers only, so you define them in the Customer data type. Because the field Employee ID applies to employees only, you define the field in the Call Center Representative data type.
On specialized data types, you can view the fields for that data type, and any fields that they reuse from the parent data type. Use the slider on the following image to view the Customer data type with and without reusable fields.
Data type sourcing
You can source data types locally from a Pega Platform system of record, or you can source data types from an external system of record. Alternatively, data types can obtain data that you or a case participant enters or changes during application processing that are not associated with any system of record.
When you determine how to source a data type, consider the questions in the following image. The questions assume that you are new to Pega Platform and that you create an application from scratch. Click the hotspots to learn about an example of each data type sourcing option.
Data type best practices
Whenever possible, use standard, commonly-used data types that Pega Platform provides, such as Address-Postal and Address-Email. You can also add relevant data types to your application.
If a data type only partially meets your needs, you can extend that data type. For example, if you want to create the Employee data type, you can extend the existing Person data type to create the Person-Employee data type.
If a suitable data type does not exist yet, create a new one. For example, if you want to add the Airport Codes data type, but you cannot use or extend an existing data type, create a new one in Pega Platform.