Getting Old data in Declar Trigger Activity
When retrieving data from a database using Obj-Open as part of a Declare Trigger activity (Committed Save), the Obj-Open displays the updated data instead of the old record.
Steps to Reproduce
- Create a Declare Trigger activity on a specific class with the below configuration
Trigger when an instance is, Committed Save
- Configure an activity.
- Use the Obj-Open of the Record on any page (for example: OldPage) during the Trigger activity.
- Create a sample activity to invoke the trigger,
a. Open any Class instance where the trigger is created.
b. Set or update any property with the New Value
For example, pyLable = 'NewData' assuming pyLable was set with 'OldDate' upfront.
c. Perform ObjSave and a Commit.
- Trace the Trigger activity (created in Step 2) while executing the Sample activity. Check the Primary page of the Trigger activity and the Obj-Open page in the Trigger activity (OldPage). Both the OldPage and the Primary Page of the trigger activity have the same data.
The Obj Open page must have Old data, (OldPage) pyLable=OldData; while the Primary Page must have New data, pyLable = NewData.
This behavior is as per Pega product design.
The Save type declare trigger executes before the page is added to the Deferred Operations List (DOL). That is, the work object is not added to the DOL during trigger execution. Therefore, the Obj-Open returns data from the database.
Here's the explanation for the reported behavior:
Obj-Open does not always fetch the work object from the database. It first checks if the work object is available in the DOL. If it is present, it returns the work object from the DOL instead of the database. In this case, since the work object is saved, it is available in the DOL with current changes. Hence, Obj-Open returns the work object with the current data.
0% found this useful