- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2017 05:17 AM
I am trying to recreate an exception like this java.sql.BatchUpdateException: Duplicate entry '0046b3f6bb927240f3611272dbdb75b8' for key 'PRIMARY' - I happened to find the solution for the same mentioned here: https://community.servicenow.com/thread/230668, but I would like to know what made this exception and I need to do to get an error message likewise.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2017 05:34 AM
In the exception you posted, the duplicate key is 'PRIMARY' which is a unique index on sys_id column (as this column is marked as PRIMARY KEY).
To reproduce this:
- have a before insert business where you use current.update()
that's the easiest way to reproduce probably.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2017 05:33 AM
That particular message indicates that you are trying to create a record with the same sys_id as another record. The primary key on pretty much every table is the sys_id field and is marked as unique. You definitely don't want duplicate sys_ids in your system.
Can I understand why you want to recreate it? What is the objective here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2017 05:33 AM
Hi Nadhan,
Please find the below links it may help you
java.sql.BatchUpdateException: Duplicate entry 'incident-priority' for key 'name'
java.sql.BatchUpdateException: Duplicate entry
Please provide your feedback appropriately (Like, Helpful, Endorse AND/OR Correct) to help community.
Thanks
Chandu Telu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2017 05:34 AM
In the exception you posted, the duplicate key is 'PRIMARY' which is a unique index on sys_id column (as this column is marked as PRIMARY KEY).
To reproduce this:
- have a before insert business where you use current.update()
that's the easiest way to reproduce probably.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 01:47 PM
Thank you! I was having this exception pop up because I was using current.update() on a before insert Business Rule.