Support Article
History and Attachments are not PURGED for cover and folder item
SA-658
Summary
History and Attachments records are not PURGED for cover and folder items
Error Messages
Not Applicable
Steps to Reproduce
1. Run the purge process manually for cover items.
2. Observe that the Data-WorkAttach-File ( attachments ) and History records in DB and PRPC are still present for purged items.
Root Cause
The root cause of this problem is a defect in Pegasystems’ code/rules.
The associated code was not written for Attachment and history deletion in the function.
Resolution
Hfix-9085 -- History and Attachments are not PURGED for cover and folder item -Change in evaluate item
HFix-9863 - When there is NO BLOB column in the history table, the above hotfix alone does not work.
HFix-9863 description :-
The changes are made in the function PURGEITEMS to trigger a RDB-EXECUTE call rather than an Obj-Delete. Doing a Obj-Delete forces PRPC to recalculate the pzinskey. Pzinskey was wrongly held in the DB because Oracle DB column for pxTimeCreated is type Date which cannot hold TIMESTAMP value. Although, the jdbc drivcer in oracle allows the automatic round off of the milli second portion of the timestamp in the where clause. This was the reason we were not getting any error in the front end.
Code changes below :-
String className = oCurrItem.getClassName();
//If a class has a datetime as a key property and the class does not have a blob, executeRDB is needed to delete the records in the table.
//since many databases round the datetime to less precision than is in the pzInsKey, the recalculated pzInsKey is different
//History classes are the only classes that have blobs regularly removed and datetime columns as key properties.
if(className.contains("history") || className.contains("History"))
{
ClipboardPage listPage = tools.createPage("Code-Pega-List", "PurgeListDef");
dbInf.executeRDB("delete from {Class:" + className + "} where pzinskey = '" + currKey + "'", listPage);
listPage.removeFromClipboard();
}
Published April 1, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.