Skip to main content
Verify the version tags to ensure you are consuming the intended content or, complete the latest version.

Rule creation

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 
pyDefault
case type rule
NewLocation property 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:

MobileHR 
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:

Pricing_Flow 

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:

RateEmployeePerformance 

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:

D_Customer
D_CustomerSavable
D_CustomerList

Note: Most rules created in Dev Studio are accessible from App Studio, but not all. Some rules require advanced configurations that are available only in Dev Studio. Dev Studio also provides wizards to create underlying rules. As a best practice, work in App Studio to ensure that the correct rule is created or updated. To learn more about rules, see Exploring rules in your application.

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.

Note: You can access rules from the Dev Studio navigation menu by clicking Records and selecting a rule type to display a list of rules of that rule type. To learn more about creating rules in Dev Studio, see the article, Creating a rule.

In the following image, click the + icons to learn more about the New Record form.

Instance key

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:

  1. The internal name for the rule type
  2. The applies to class for the rule
  3. The identifier of the rule
  4. 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.

Note: Some rule types extend the instance key with additional elements. For example, correspondence rules include the correspondence type as part of the instance key. The correspondence type differentiates a correspondence rule to generate an email from a correspondence rule to generate a text message, even if the two rules share a name and class. 

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.

  • Identifier
  • Class
  • Ruleset
Creating a rule from the Records explorer The application context and ruleset are specified by default.
Tip: When creating a rule from a rule reference, the label is determined from the rule name in the referencing field. Consider adding spaces to the label to make the rule description easier to understand.

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:


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