I have a requirement where I need to store history for the changes done by users on the datatype records which is delegated . changes like who updated it? if value is changed then from what previous value to new value ? who deleted it ? who added new entry ?
Steps followed by me
Created TrackSecurityChanges Declare trigger in prod ruleset which is delegated
pyTrackSecuritychanges Data transform with all Data table fields I want to track
I am able to track the changes done to add new entry or update any value in the record.
But I am unable to track if someone has deleted the entry from the Datatype records. Declare trigger is not invoked when deleted. Did anyone face the same issue and found any work around.
I’m not aware of any solution to this with the standard auditing features. There are lots of posts asking this question but no solution.
Declare Trigger rules should run when deleting instances (according to the documentation - Pegasystems Documentation).
So you should be able to implement an audit for deleting data (but note that if you delete a data instance, standard history reports won’t be able to join the history to the data table using the key).
There is an alternative solution you can do which would solve the issue, but might not be ideal for your application:
Prevent users from deleting data instances through the security model.
Instead of deleting, add a Status/Deactivation column to the data type. If the user sets the status as deactivated then this should be filtered out of all results in your application as if it were deleted.
This way you can audit the changes to the status column.
Alternatively you might be able to implement your data as custom rules, this would enable the full rule auditing which includes deletion.
On the data class rule form there are options for capturing history snapshots on create, update, delete.
Setting this option to false generates a history class for your data class and will enable snapshot tracking when editing records via the records tab (same as rule history snapshots):