When Test Plan is created getting Error Message saying Unique Key violation detected by database ((conn=399463)


Description

When trying to create a new Test Plan in the Release Test plan related list getting below error.
Error Message Unique Key violation detected by database ((conn=399462) Duplicate entry 'f22aac64db2c98d01acbf8ea0c9619d9' for key 'PRIMARY').

Steps to reproduce:
1. Go under any release under agileĀ 
2. Configure Related List ---Test Plan->Parent(there are 2 of them)
3. Click on new from the related list and make sure it creates a record in "sn_test_management_test_plan" table
4. You'll observe the error

Release or Environment

All

Cause

It is the design which is not supported.

Resolution

The test plan related list is not functionality which is designed to be available OOB.
Also, the parent field of the test plan is not functionally designed for that.
To have a relationship between the test plan and a release, it is recommended to have a reference field in the test plan, referring release record.
Once this relationship is developed then the error message won't be occurring as the business rules and script includes will be updating the desired fields.
As there is no relationship between release and test plans, the business rules are trying to update the record when there is an insert transaction happening into the database.

The thing is tm2.0 has a different use for the parent field, it is not meant to refer to any planned_Task like a table (release is a child table of the planned task).
If you want a relationship between the test plan and any other table, our recommendation is to add a new field to the test plan, which refers to that table