Declare Trigger Activity on Assign- , NULL values on WorkPage during processing
Requirement: We are running a declare trigger on (Committed Save) of Assign- class and When (Some Properties are Modified) of Work Class. In the invoked activity we are setting several properties from the WorkPage. However, we are facing two different issues at different times:
1. During some scenarios- WorkPage has a NULL value of pxUpdateDateTime and resulting in a invalid date time error at the step we are copying this in the invoked activity to another page. This is happening when we are trying to resolve the case that too only during certain specific scenarios. (Using a custom Resolve icon- however it calls the same Pega Resolve flow- unable to find the root cause so far).
2. During some scenarios- WorkPage itself doesnt exist.
I am aware that during declarative rules, actual commit might happen a little later than when the activity is invoked. But am unsure how to debug which scenario is this and how to handle. Its important for us to fetch the WorkPage details during the invoked activity itself.
These issues are only observed in PROD and we are unable to reproduce even in UAT.
For pxUpdateDateTime, if you expect it to be null sometimes, check for that before attempting an operation that assumes it to be a date-time.
If you don't expect it to ever be null, you could consider using an on-change handler that announces to the log file that for an obect of your particular work class, pxUpdateDateTime just changed value (and what the old and new values are). If you also announce when work objects of your class are written to the db, you can check the pattern of changes to pxUpdateDateTime and how they interleave with the writing, to get an idea of what the situation is in which the write happens when the value is null.
If you're seeing the work page nonexistent in your trigger, you'll want to know whether it never existed or whether it recently got deleted. Again, announcing all writes and deletions of instances of your particular work class to the log file could help, so you can see what the pattern is.