Have users reporting comments being deleted or edited from defects. I would like to try and track these edits to find out why comments have been removed or changed, and if user error or on purpose. How can I best track these edits then?
Answer by MrWhite · Jan 10 at 06:45 PM
Below is an explanation of a method to track edits to defects comments.
This requires just one setting change and then either site admin or database access to the project database to search for the edits. Can search the AUDIT_LOG and AUDIT_PROPERTIES tables under the project to see the changes.
First, we need to enter project customization and click on Project Entities on the left. In the tree expand Defects and then under it System Fields. Click on Comments to view the Settings for the field. Here you will want to put if not present a check in the box next to History. Save the edit and exit customization.
Next, can either log into site admin or connect to the DB directly. Find the project in question’s database and expand the tables to find the AUDIT_LOG table. Open the contents of this table to view the column names and data under them.
Under Audit_Log there is a column named AU_ENTITY_ID. This ID column will have the ID of the item that has a change the log has recorded. As you want to track Defect changes, you will need to know the Defect_ID for a defect who had a comment change. Using that ID number, search for AU_ENTITY_ID that matches the same ID number. If you want to see an edit to defect ID 88, search for AU_ENTITY_ID = 88. That will show you the row for the change. From this row result, you will want to note the AU_ACTION_ID. We will use that value to search in the next table, the AUDIT_PROPERTIES table. For example, the AU_ENTITY_ID = 88 had AU_ACTION_ID = 323. We note the 323.
Under the AUDIT_PROPERTIES table, you will see an AP_ACTION_ID column. This AP_ACTION_ID will be same value of the AU_ACTION_ID from the AUDIT_LOG table. As we noted we want value 323, we then search for AP_ACTION_ID = 323. This will return the row for the action/edit taken for the defect ID of 88. The result will have columns such as AP_FIELD_NAME (you will want check it is BG_DEV_COMMENTS) and AP_PROPERTY_NAME (Comments). The data you will want to look for to see edits is under columns AP_OLD_VALUE, AP_NEW_VALUE, and more likely for a comment look to AP_OLD_LONG_VALUE and AP_NEW_LONG_VALUE.
The value columns should show you changes (edits) to the comments. You can view the before and after text. If a comment was deleted, you would see before text and then blank for the new value. If you do see an edit and you want to see which user was involved with that edit, go back to the AUDIT_LOG and you can check which AU_USER performed the action (in this case an Update).