Automated rule creation
In App Studio, rules are created automatically in the predefined application rules layer when you use the Case Designer. It is a best practice to work in App Studio so that the rule creation process includes preset defaults. By building your application in App Studio, you minimize issues and errors that are related to rule creation.
The following table provides examples of how your work in the low-code workspace of App Studio affects rules in the background.
|App Studio||Dev Studio|
|When you add a new case type in App Studio ...||
It creates underlying rules available from both App Studio and Dev Studio, such as a case type rule and data pages. For example, adding an Employee relocation case type extends the TGB-HRApps-Work class to create a new work class, TGB-HRApps-Work-EmployeeRelocation, with rules such as:
D_EmployeeRelocation data page rule
|When you add a Mobile channel to your application ...||It creates new rules in Dev Studio. For example, adding a Mobile HR channel to an existing HR application creates new user interface rules in the Data-Portal class:
|When you add a new process in App Studio Case Manager ...||
It creates a new flow rule in your Pega application. For example, adding a Pricing process in the Benefits enrollment case type creates a new flow rule applied to the TGB-HRApps-Work-BenefitsEnrollment class:
|When you add a view in App Studio ...||
It creates a section rule in Dev Studio, and it sets the required class context for you. For example, if you add the Employee performance view in App Studio, it adds a section rule in Dev Studio that applies to the TGB-HRApps-Work_EmployeeEvaluation class:
|When you add a new data object using the Data explorer in App Studio ...||
It creates data pages based on the type and source of the data object. For example, if you create a Customer data object, it will create three data page records in the Data class:
Rule creation in Dev Studio
If you need more control over how a rule is created and reused, you can create rules in Dev Studio. Dev Studio uses the term records to refer to rules, properties, and other objects in Pega Platform™. When you create a rule in Dev Studio, the New Record form prompts you to provide four pieces of information:
- Rule type: Specifies the function. For example, is the rule for a report definition, field value, data type, or flow action?
- Ruleset: Specifies the ruleset in which to organize the rule to improve the reusability of rules across your applications.
- Apply to: Specifies the class that the rule applies to, for example, whether the rule applies to the Work, Integration, Data, or another class.
- Label: Specifies the name that you want to use. The name helps you find the rule during development and testing.
These four pieces of information identify the rule as unique within your application. This combination allows an application to call the correct rule during case processing through a process called rule resolution. With rule resolution, Pega Platform determines the appropriate rule to run when an application calls a rule.
In the following image, click the + icons to learn more about the New Record form.
Pega Platform creates a unique instance key — stored by using the property .pzInsKey — to identify each rule on the system. The instance key generally consists of four elements separated by a space:
- The internal name for the rule type
- The applies to class for the rule
- The identifier of the rule
- The timestamp from when the rule was created, normalized to Greenwich Mean Time (GMT)
For example, you create a service level at 11:31:52 AM Eastern Time (ET) on January 20, 2021, by providing the following information on the New Record form.
- Identifier: StandardApproval
- Apply to field: MyOrg-MyApp-Work-CaseType
The .pzInsKey for the rule is RULE-OBJ-SERVICELEVEL MYORG-MYAPP-WORK-CASETYPE STANDARDAPPROVAL #20210120T163152.765 GMT.
Rule creation methods
You can access the New Record form in several ways based on how you create a new rule. The manner of rule creation determines the amount of information that is automatically entered. When creating a new rule in Dev Studio, you may have the option to make the rule available to users in App Studio, depending on the rule type.
The following table describes some rule creation methods and identifies the information specified on the New Record form.
|Method||Information specified on the New Record form|
|Create a rule from the Create menu||The rule type, application context, and ruleset are specified by default.|
|Create a rule from the App Explorer||The rule type, application context, ruleset, and class are specified by default.|
|Create a rule from a rule reference||The rule type, application context, ruleset, and class are specified by default. If the name of the rule is provided in the reference, the label and identifier for the rule are also specified.|
|Open an existing rule and click Save As||
The rule type, application context, ruleset, class, label, and identifier are specified by default. However, at least one of the following pieces of information must change, or Pega Platform returns an error when you click Create and open.
|Creating a rule from the Records explorer||The application context and ruleset are specified by default.|
In the center of the following image, slide the vertical line to compare creating a service-level agreement (SLA) rule from the Create menu and creating a service-level agreement (SLA) rule from the App Explorer.
Check your knowledge with the following interaction: