Unique Key violation detected by database (Duplicate entry '8034aa69dbf0530007b07d598c961982' for key 'PRIMARY') 8034aa69dbf0530007b07d598c961982? Why I am getting this error.

Raju Singh1
Tera Expert

Hi Experts

Please help me on this!!

I am getting this error.

Unique Key violation detected by database (Duplicate entry '8034aa69dbf0530007b07d598c961982' for key 'PRIMARY')

 

find_real_file.png

 

I have written an after Business Rule on update of sys_user table. I am not sure why am I getting this error.

As per my requirement whenever there is a termination date found in the User table. It should create an RITM when there is an update in the User table.

The script is provided below which works fine and the Request and the RITM creates successfully.

The only issue is with the error which I am getting.

Here is the screen shot of the Business Rule and the script provided below.

find_real_file.png

 

(function executeRule(current, previous /*null when async*/) {
 // Add your code here
var requested_for = current.name;
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
var item = cart.addItem('8ff73f67db9bcb40952dff971d961989');
cart.setVariable(item,'o_adobe_cc',true);
cart.setVariable(item,'o_adobe_dc',true);
cart.setVariable(item,'o_ajera',true);
cart.setVariable(item,'o_arena',true);
cart.setVariable(item,'o_autodesk',true);
cart.setVariable(item,'o_bluebeam',true);
cart.setVariable(item,'o_credit_card',true);
cart.setVariable(item,'o_email',true);
cart.setVariable(item,'o_primavera',true);
cart.setVariable(item,'o_sap',true);
cart.setVariable(item,'o_webcatalog',true);
cart.setVariable(item,'o_zoom',true);
cart.setVariable(item,'o_employee',requested_for);
//current.short_description = "Offboarding request for " + current.variables.o_employee.name;
var rc = cart.placeOrder();
gs.addInfoMessage(rc.number);
})(current, previous);

find_real_file.png

 

2 REPLIES 2

Mike Patel
Tera Sage

Search user table Filter sysid is 8034aa69dbf0530007b07d598c961982

Most likely there is another account with same user id or email

pclp
Kilo Explorer

I had the same error:

"Error Message Unique Key violation detected by database ((conn=271290) Duplicate entry '91a830a54983945085cdb14a691122fc' for key 'PRIMARY')"


In my case I used a business rule to assign the value to the field which didn't exist.
newTask.ms_doc = current.sys_id;