We have a declare trigger activity defined at the work object class to commit few changes to one physical data base table with pyStatuswork & one other Specific tracking properties. At the trigger activity we have the necessary property set for the new class (mapped to physical DB table) with Obj-Save adding to the deferred list and expecting the Deferred save to commit the changes with the Assignment/Work object commit.
Problem Statement: Work Object status was changing from Open* to Resolved* and since we had a Declare trigger event on status & other specific property we have two events logged one from Open Status & other from Resolved Status. Our trigger activity is firing with two Obj-Save one with Open Status timestamp of 20150618T165945.245 GMT and 20150618T165945.927 GMT of Resolve timestamp and expecting when final commit happens the Obj-Save with the deferred list should execute in the order of queue (First come first out) execution. But in our case the Resolved one is executing first.
Attempted Solution: We tried using explicit Commit since Trigger activity doesn't allow Obj-Save with write now and it worked correctly. As this method forcing work object changes to commit and no deferred list.
As per Pega Help documentation Commit/Obj-Save with write now shouldn't be used with Declare triggers.
Please share your inputs if you have come across such issues.
***Updated by moderator: Lochan to close post*** This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.
I was referring to "ONE OF THESE PROPERTIES WAS MODIFIED" settings available on the trigger. These are the Properties to watch for the event change and the Trigger When an Instance Is used as "Saved And..." selection.
I'm not sure I understand. Are you changing values on the work object and doing commits from within the trigger? That is a dangerous thing to do for a number of reasons (you break the transaction boundary mid transaction, for one, and declare triggers shouldn't be firing other declare triggers to avoid recursive loops, so other triggers may not be working as expected, are the first thoughts that come to mind). That said, we don't guarantee the order of the deferred list. Are you trying to track these changes via history or some other mechanism where perhaps you could append the update to a pagelist during your save trigger and then in a committed save trigger, iterate through the list and write the history entries in that order? Basically, without fully understanding your business requirements, I suspect that there is another approach that you can/should take that will work for you and not do so in a potentially dangerous way.
You're doing this for tracer? I'm confused. Where are you writing these changes? The work object itself? Some external table? What is the business problem that you are trying to solve? I think if I understood that a little better, I might be more able to give you better guidance.
1. We are using tracer as debugging tool to find the Obj-Save timings from trigger activity.
2. These changes are on to a PegaRULES physical database table(not the work object table). We have a Business requirement to log few work object events on to this table and this records will be consumed by other application using ETL data load.
3. Business requirement is when Work Object status changing from Open* to Resolved* we have two events logged one from Open Status & other from Resolved Status with a deferred Obj-Save.
while execution it is not picking/executing in the order of queue.