Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Unique key violation

Sai Easwer Tej
Giga Expert

Hi All,

 

I am getting two errors while creating a new record.

 

Errors:

1. Invalid insert

2. "Unique key violation detected by database ((conn=number) Duplicate entry 'Field value entered by me' for key 'field'

 

Note: The field is unique false in dictionary and I'm not using current.update.() in the business rules.

 

How can I fix these errors?  I'm not sure because of which script I'm getting error.

 

Thanks in advance

2 ACCEPTED SOLUTIONS

Daniel Oderbolz
Kilo Sage

Hi Sai

Check if there is a database index (sys_index) on the table in question with a UNIQUE constraint (unique_index=true).
This is enforced on the lowest possible level (the database) and is not reflected in the dictionary.
Best
Daniel


If this post was helpful, I would appreciate if you marked it as such - thanks!

Best
Daniel

View solution in original post

Hello @Daniel Oderbolz ,

 

I have checked the sys_index table, all are Unique index = false. Is there any thing I need to check?

 

Thanks

View solution in original post

5 REPLIES 5

Daniel Oderbolz
Kilo Sage

Hi @kalpesh9 
Thats a good hint, but typically does not lead to a UNIQUE CONSTRAINT violation. The only unique index that is always present on a table is on sys_id, normally number is not unique.


If this post was helpful, I would appreciate if you marked it as such - thanks!

Best
Daniel