Error when we try to create new PA indicators -- java.sql.BatchUpdateException: Duplicate entry


Description

Symptoms

Getting the following error while trying to create the PA Indicator on the instance 
Error : "java.sql.BatchUpdateException: Duplicate entry <xx> for key 'id'" 

Release

All current release

 

Cause

1. Out of the Box the ID column on the pa_indicator table has a unique index in the database. 

2. The following Number counter determines the value for the column --> ID on the inserted record 
>> https://<instance-name>.service-now.com/sys_number_counter_list.do?sysparm_query=table%3Dpa_indicators 

3. While creating the record on pa_indicator if the "ID" is not unique the system will error out and will not insert the transaction as the unique key violation.

Resolution

1.Determine the maximum number value on the column ID on table pa_indicators

https://<instance-name>.service-now.com/pa_indicators_list.do?sysparm_query=ORDERBYDESCid&sysparm_first_row=1&sysparm_view=Automated

2. Determine the Number counter for the pa_indicators table on the instance

https://<instance-name>.service-now.com/sys_number_counter_list.do?sysparm_query=table%3Dpa_indicators 

 

3. The Number counter should be greater than or equal to the Max Number determined in step 1 , if not update the Number counter to be greater than Max number (i.e in given example update the number counter to 101)