# Is declare trigger is run by an agent

**URL:** <https://forums.pega.com/t/is-declare-trigger-is-run-by-an-agent/1112>\
**Category:** Blueprint and App Design\
**Tags:** low-code-app-development, other-industry, lead-system-architect, pega-platform, case-management\
**Created:** [February 7, 2021, 7:36am UTC](https://forums.pega.com/t/is-declare-trigger-is-run-by-an-agent/1112 "2021-02-07T07:36:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SantoshCLSA](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/santoshclsa/32/883_2.png) [@SantoshCLSA](https://forums.pega.com/u/SantoshCLSA)\
**Post date:** [February 7, 2021, 7:36am UTC](https://forums.pega.com/t/is-declare-trigger-is-run-by-an-agent/1112/1 "2021-02-07T07:36:03Z")

</div>

Is declare trigger/Declare onchange rule run by an agent? how does it monitor the change in the property value ? Can someone provide more insight on this?

---

<div class="post-metadata">

**Author:** ![BraamSmithCLSA](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/braamsmithclsa/32/4409_2.png) [@BraamSmithCLSA](https://forums.pega.com/u/BraamSmithCLSA)\
**Post date:** [February 7, 2021, 11:00pm UTC](https://forums.pega.com/t/is-declare-trigger-is-run-by-an-agent/1112/2 "2021-02-07T23:00:49Z")

</div>

@SantoshAnisetty

**Declare Triggers** , specifically, are tied to Save and Delete events. When the Pega Engine is instructed to do a Save, Delete, “Committed Save” or “Committed Delete” operation on an instance (like a work item), it seeks all the corresponding Declare Triggers for the Applies To class of that instance, and executes them before returning control to the caller of the Save or Delete operation.

For monitoring changes in property values, you may be more interested in **Declare On Change** rules. These are fired as the Pega Engine transitions from one Activity step to the next, and detects changes in the properties configured on any matching Declare On Change rules (based on the Applies To class of the pages with modified properties).

---

<div class="post-metadata">

**Author:** ![SantoshCLSA](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/santoshclsa/32/883_2.png) [@SantoshCLSA](https://forums.pega.com/u/SantoshCLSA)\
**Post date:** [February 8, 2021, 5:13pm UTC](https://forums.pega.com/t/is-declare-trigger-is-run-by-an-agent/1112/3 "2021-02-08T17:13:36Z")

</div>

@BraamCLSA Thanq Braam

---

<div class="post-metadata">

**Author:** ![gundrathinaveen27](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/gundrathinaveen27/32/12950_2.png) [@gundrathinaveen27](https://forums.pega.com/u/gundrathinaveen27)\
**Post date:** [February 11, 2021, 5:01am UTC](https://forums.pega.com/t/is-declare-trigger-is-run-by-an-agent/1112/4 "2021-02-11T05:01:44Z")

</div>

Hi @BraamCLSA ,

Will **Declare On Change** rule only fired, when there is changes in property value using only **Activity** rule ?

---

<div class="post-metadata">

**Author:** ![BraamSmithCLSA](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/braamsmithclsa/32/4409_2.png) [@BraamSmithCLSA](https://forums.pega.com/u/BraamSmithCLSA)\
**Post date:** [February 12, 2021, 7:43am UTC](https://forums.pega.com/t/is-declare-trigger-is-run-by-an-agent/1112/5 "2021-02-12T07:43:53Z")

</div>

@naveeng5663

**Declare On Change** fires regardless\* of the rule type which changes the property value, but it does not fire until the current Activity step completes, as that is when the declarative network is examined for changes.

_\* maybe there are some special exceptions, but that’s the general philosophy_

_Usually_ there is an (out of the box) Activity rule that is orchestrating the execution of other rules in your configuration, using methods like **Apply-DataTransform, Obj-Validate** and **Property-Map-DecisionTable**.

Take a Data Page of Data Source “Lookup” and with a Response Data Transform, for example. Ultimately, the Pega Engine calls the Activity _pxObjOpen_ to load this Data Page, in which Step 1 is a Java step that orchestrates loading the instance and running the Response Data Transform. The declarative network is not examined for changes the Data Transform may have made to monitored properties until that Java step in the Activity completes.

I often used to get caught out when I configured Step 1 of a Data Transform to change to a monitored property, and assumed that by Step 2 (in the same Data Transform) that the Declare On Change should have fired. It doesn’t fire then, but it would _typically_ fire when the Data Transform invoked by the Activity finishes.

In the circumstances where an Activity is not involved and the Pega Engine is orchestrating your rules directly, it is up to the Engine when it examines the declarative network for changes.

The best way to check for sure in your scenario is to run the Tracer with the “Declare OnChange” event turned on, after which the Tracer will show after what rule event a Declare On Change rule fires following a change to a monitored property.

Please reply back with what you find!
