Notifications

617 views

Description

If the system property com.snc.time_worked.update_task_timer is set to true, the business rule 'Update task timer' creates a new empty record in the task table when deleting an incident. That new task record has the same sys_id as the deleted incident.

As a result, the incident cannot be undeleted (from sys_audit_delete). Trying that will result in the error:
Unique Key violation detected by database (Duplicate entry '962cfe3c0f3572006939fa6ce1050eae' for key 'PRIMARY')

 

Steps to Reproduce

1  Set the property com.snc.time_worked.update_task_timer to true
2  Open the Incident form.
2.1  Make the time_worked  task field visible
2.2  OR  make the task_time_worked related list visible
2.3  Optionally also add the 'Time worked' field to the form so that any update in the incident automatically generates a task_time_worked record in the related list (every time the incident gets saved).
3  Open an existing incident.
3.1  Click the New button in the task_time_worked related list.
3.2  OR  add updates in worknotes if the 'time worked' field was added as well.
4  Save and update the incident.
5  Search and query the updated incident from a task list view.
6  Right click on the incident number and copy its sys_id
7  Open task.LIST (in a new tab) and query the record for that sys_id
8  Verify it is listed as an incident.
9  From the first incident list view (in step 5) select the record and delete it through the actions menu.
10  Verify it is no longer in the list.
11  Refresh the tab from the task.LIST. The new run query will show it is not a TASK record.
11  Open sys_audit_delete.list
12  Find the deleted incident and try to undelete it. You will get the error reported above.


Workaround

This problem was fixed in Jakarta. On an older release perform the following:

  1. Import the sys_script_2ebd0e17c0a80a6d44cad01349d5d0f9.xml that is attached to this incident. It has a modified script to work around this. To import the file, go to any list view, rightclick on the column headings and choose Import XML. Select the file and import it. That will overwrite the existing business rule
  2. With that, test again by deleting incidents and trying to undelete them. It should work ok now.


The changes in the script compared to the out-of-box one are:

  • Additional debug log messages (writing to the localhost log) that would allow you to track what happens in case of issues. For a production instance those could be commented out, but while testing it would be best to keep them.
  • an additional check that verifies the incident to update actually exists; if not, it will not try to update anything, causing an unexpected insert of a TASK record.

Related Problem: PRB908462

Seen In

There is no data to report.

Fixed In

Jakarta

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-02-23 07:47:12
Published:2018-02-23