How to enable audit functionality for deleted records
Out of the box Service Manager Auditing functionalities do not audit deleted records because the original code bases the decision of creating an audit record comparing the old record on memory against the new record and because both records are the same by the time users delete the record, no audit record is created.
In order to add this functionality to SM, please follow these steps (Note: This process is required for each table that requires delete auditing)
1- Confirm Audit Specifications exist for the table delete audit is required. Go to System Navigator > Tailoring > Audit > Audit Specifications.
2- Search for the table name under filename to confirm fields are set for audit. If not, add the required values into Filename, Unique Fields, Field Name to Audits and Alias (Label for Users).
3- Once Audit Specifications exist, create a master format control for the table that requires audit. If it exist, please use existent format control.
vars.$fempty=new SCFile("tablename"); ---- Replace tablename for the name of the table to audit
6- Now go under subroutines section, look for an empty line and set delete condition to true (or any required condition). In application field add: audit.compare
For names field add:
For values field add:
7- Now save changes.
8- Finally confirm when users access any form that uses master format control and they delete the record an audit record is created for the action.