Hi Everyone,
I have a declare trigger in my application which is triggered when an instance is saved and one of the properties is modified. In the property watch list, I have 3 properties. Is it possible to know by modifying which property this declare trigger is fired.
Req: Based on which property is it modified, I wanted to generate my payload and skip unwanted info if that property is not changed.
Thanks in advance.
@NAVAKANTHM
In declare trigger you would be able to copy the values which has been modified. Attached screen shot for reference, inside trigger activity you can compare the old and new values and then have your logic to generate payload.
@GunaSekaran_B
Declare trigger gets invoke when any of the three properties is modified and when the instance is saved.
So basically the properties which we mention there is a or condition , so any property out of three properties is modified trigger is invoked.
it is possible to check with property is modified and accordingly we can send the payload .
One of possible solution is , We can have three separate declare triggers with common activity wrapped under parent activity This Parent activity is unique for each property change and we can send the unique payload accordingly.
As it will be difficult to know the previous and current value and it will become complex to know their value , I suggest this approach.
Solution apart , i request you to reconsider the requirement discussion and check if it can be done in any other better way.
@Arshad8101
If we are taking backup value inside trigger, we could easily identify which value got changed like that..
If any property value got changed then UpdateProjectInfo and ProjectInformation page monitoring properties which i have mentioned in screenshot will have different value. By comparing this two page property values easily we can find which values got changed and build logic inside trigger activity to trigger payload. We are having lot of features in pega to compare values and to trigger post process.
For this design we can use collection rule inside trigger activity and easily achieve the business need if we need to have (A OR B…) or (A AND B…) logic.
Having trigger rule for each monitoring property would not be a recommended approach also, if-in case in future still we need to monitor another 3 new property values, for that also we need to create new 3 trigger rules it will be hard for us to maintain the code.
@GunaSekaran_B
If trigger itself hold previous and current values - true we can take this approach .
If one or two properties , can go with the approach i suggested as extra overhead to check if value has changed and copying values to page can be avoided.
Appreciate @GunaSekaran_B .
@ArshadPashaMohammed Thanks Arshad for your response. I do accept, if one or two properties we can go with your approach. But as Guna mentioned, if we have start watching multiple other properties in future it doesn’t seems good. Thanks for your valuable suggestion.
@Gunasekaran Baskaran Thanks for your response. I was looking for any internal Pega maintaining pagelist to track the changes. If no internal Pega pagelist, we can go with your approach for tracking the changes.