- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2016 10:34 PM
I'm trying to update the short description on my request with the requested item's catalog item display value with an on after business rule. The script works and the short description is updated but I keep getting a message like Unique key violation detected by database (duplicate entry '81135af74f57124029de98701310c7a0' for key primary). I'm not sure why this message is appearing and what is relates to.
My business code like like the following
var request = new GlideRecord("sc_request");
var item = new GlideRecord("sc_cat_item");
request.get(current.request);
item.get(current.cat_item);
request.short_description = item.getDisplayValue();
request.update();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2016 12:08 AM
Hi Chris,
The error you are getting is a database error and it means that you are trying to do an insert for a sys_id that already exists. This usually happens if you have a before BR with current.update() which would trigger an insert already.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2016 10:50 PM
There may be some other business rule written in sc_request table which is causing this error.
The sys_id in the error message is same every time or different?
This sys_id belongs to which tables record ?
Thanks,
Mihir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2019 02:01 AM
hello, I would be interested in your opinion in case the sys_id displayed in the error log is always different. Thank you in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2016 10:52 PM
Hi Chris,
Unique key means the error is related with sys_id.
I would advice you to change request.get(current.request) to request.get( current.sys_id).
Raj

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2016 11:02 PM
Hi Chris,
Make sure that there is no 'current.update();' statement in any of your 'Before' business rules.
Thanks
Abhinandan