i am getting this Unique Key violation detected by database (Duplicate entry 'org.mozilla.javascript.Undefined' for key 'PRIMARY') when i tried to add a new attendee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2016 03:48 PM
I followed the build a servicenow sample application and on Lab 15 i added a new business rule. I copied and pasted the javascript in the example and when i tried to add a new attendee i get the above message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2016 08:47 PM
Hi Kee,
Unique key violation comes when there is already record in the system with the same primary key. so attendee record will be already there in the system hence it is throwing an error.
Please check the attendee table and search for the name which you are creating now. it will be there so no need to create just you need to check if that attendee properties roles fulfills your requirement else you will have to create a attendee with different name.
Regards,
Atul Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2016 06:22 AM
The issue is usually caused by a business rule that runs before an insert and contains an current.update() operation. If that's the case, removing the current.update() fixes the issue. Check if you have any BRs of this type on that table.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2017 03:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2017 04:03 PM
Along with making sure there are no current.update() calls in a before business rule or checking your tables Unique dictionary records, I have also found that an error like this will occur when you try to create a record via a script with a field name that does not exist on the table. Or, at least, trying to set the scope of a record that is not an application metadata record.
For instance, I'm copying a form and when I got down to the 'sys_ui_element' table, it turns out there is no sys_scope field on that table. Surprise!
Which meant my:variable.sys_scope = scope.sys_id
line of code was causing the unique entry error. Since it simply didn't exist, I just took out that line of code and good to go.
It may not be an answer to your question, but I wanted to put this out there so it gives people with this error more to troubleshoot.