Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Declare Trigger rules

Updated on November 15, 2021

To define correlations between events in your case types, create Declare Trigger rules to cause an activity to run when a specified event takes place in a case. By creating Declare Trigger rules, you automate your business processes and flexibly respond to dynamic business needs.

Declare Trigger rules are a part of the declarative rules that implement the declarative programming paradigm in Pega Platform.

For each Declare Trigger rule, Pega Platform monitors database operations for objects that you specify as the Applies To class, and concrete classes that are derived from that class, such as a class that stores your case type. When a change affects a specified property, Pega Platform uses the Change Tracking feature to monitor updates to the property values and run triggers accordingly.

For example, a Declare Trigger rule can invoke an activity each time a user changes a postal code in their personal details. By changing their postal code, the user modifies a Data-Party.pyPostalCode property in an instance of the Data-Party-Person class. The activity that you specify in the Declare Trigger rule sends an email message to the customer service representative (CSR) whose territory includes the new address. Similarly, a Declare Trigger rule can implement a form of logging or audit history for a class by recording the date, time, and other facts. You can run Declare Trigger rules in the following scenarios:

  • Page Save
    • In context
    • In background
  • Page Delete
  • Page Commit

Nested Declare Trigger rules

To resolve complex use cases, you can nest a Declare Trigger rule within another Declare Trigger rule. Nested Declare Trigger rules work in the context of the other Declare Trigger rule. For example, you can define a Declare Trigger rule that sends an email to a CSR when a customer updates their address details. Then you can create and nest another Declare Trigger rule that creates a document with the updated details after the case moves to the next stage. You can only nest rules of the Save and Save and types that run immediately. Nesting rules in the context of the Commit type rules might result in adding an excessive number of deferred operations during one database transaction. To avoid recursion during nesting of declare triggers, you can only nest a trigger in a trigger that is not already running on a page in the execution stack. For example, if a Page A save leads to a save of Page B and a trigger on Page B again leads to a save of Page A, the declare trigger does not run again on the Page A save.

The following figure presents how nested Declare Trigger rules start events in a case:

Triggering events in a case
A diagram of nested Declate Trigger rules that start events in a case.

To nest triggers, set the value of the declaratives/nestedTriggersEnabled dynamic system setting to true. For more information, see Creating a dynamic system setting.

Applying Declare Trigger rules

Immediately after you save the rule, your application runs a Declare Trigger rule according to your provided configuration.

  • Creating Declare Trigger rules

    Define correlations between events in your case types by creating Declare Trigger rules. Declare Trigger rules run activities as a response to a specified event in a case. As a result, you provide flexible applications that precisely meet your business needs.

  • Declare Trigger form - Completing the Pages & Classes tab

    Use this tab to list the clipboard pages referenced by name in the Triggers tab. See How to Complete a Pages & Classes tab for basic instructions.

  • More about Declare Trigger rules

    Create Declare Trigger rules to cause an activity to run when instances of a specific class are created, updated, or deleted in the database. This implements a form of forward chaining.

  • Previous topic How to implement business exception processing with policy overrides
  • Next topic Creating Declare Trigger rules

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

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.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us