Tasks built in related table task_time_worked do not allow any task or time worked to be saved if the related records are added before the main record save
When inserting a record into the Time Worked embedded list prior to submitting the record, a unique key violation occurs and the record cannot be submitted. This error only occurs when the com.snc.time_worked.update_task_timer property is set to True.
The error is:
Unique Key violation detected by database (Duplicate entry 'sys_id' for key 'PRIMARY')
Steps to Reproduce
- Navigate to System Properties > All Properties.
- Search for com.snc.time_worked.update_task_timer.
- Set Value to true.
- Navigate to Incident > Create New.
- Right-click on the header and select Personalize > Form layout.
- Add Time Worked->Task from Available to Selected.
- Click Save.
The Incident form should open.
- In the Time Worked embedded list, click Insert a new row and enter any value.
Ensure that you have not saved the incident record.
- Right click on the header and select Save.
The unique key violation error occurs and your record is not submitted.
This is expected behaviour when a business rule on the Task Time Worked table is set as a "Before" rule. Changing it to an "After" rule makes the violation disappear. Creating a related record before creating the current one gives this error, in case there is a before business rule on the related record.
Related Problem: PRB590991