Posted: 1 Mar 2019 17:07 EST Last activity: 17 Feb 2021 10:12 EST
Writing Audit Log to PEGA Log
I am using Field Level Auditing and pyTrackSecurityChanges to detect any changes to the WO properties. Any changes to the properties are written to the Pega Audit Log. I can actually see/view the Audit Logs on the screen. Can some one explain HOW this is written to the PEGA Audit Log. What is the mechanism?
Customer is asking for the same Audit Logs to be written to PEGA Logs.
Is there a way to capture the Audit Log being written and have the same written to PEGA logs? If I know the triggering event for the Audit Log, I can perhaps write the same to the PEGA Logs. Any ideas would be appreciated.
***Edited by Moderator Marissa to update platform capability tags****
When field level auditing is enabled for a class, the pyTrackSecurityChanges Declare Trigger is created and runs the TrackSecurityChanges activity. You can review the Declare Trigger and activity to see how the details are written to the audit history.
Once a WO is resolved, on the clipboard, you can view the PEGA Audit on the DataPage D_pyWorkHistory. This DataPage will contain the results of any changes and/or additions to properties you have declared for your Field Level Auditing. You can leverage this DataPage to write to PEGA logs, using Log-Message in an Activity.
I have implemented an Activity that writes to the PEGA Log, the changes that occur AFTER a WO is resolved using a Trigger.
The WriteToPEGALogsFromMaintenance Activity (of Type TRIGGER) uses a
WHEN rule that evaluates to TRUE when a property value is changed -
@String.startsWith(.pyMemo,"ChangeTrack") and a
JAVA step to convert the Audit String using getLocalizedTextForString
Log-Message can be used to write PEGA Logs and I have used regular expression function pxReplaceAllViaRegex to remove unwanted spaces in the Audit Text present in property pyMessgeKey - @String.pxReplaceAllViaRegex(.pyMessageKey,"\\s+"," ").
Using Log-Message you can even write to PEGA Log any extra information that is not displayed to end user on the PEGA Audit Log (usually Time, Description and Performed By), for example the time the WO was resolved and the CaseID as