Unique Key Violation Detected by Database

Rob Sestito
Mega Sage

Hey SN Comm Team,

I am all of a sudden getting the following error:

find_real_file.png

I received this after I made a change to the following BR:

find_real_file.png

**Newest code commented out for now when trying to figure this out**

(function executeRule(current, previous /*null when async*/) {

	var d2 = new GlideDateTime(current.getValue('u_first_letter_sent'));
	d2.addDaysLocalTime(22);
	current.u_second_letter_sent=d2;
	
	var d3 = new GlideDateTime(current.getValue('u_second_letter_sent'));
	d3.addDaysLocalTime(15);
	current.u_third_letter_sent=d3;
	
	//var termLetter = new GlideDateTime(current.getValue('u_third_letter_sent'));
	//termLetter.addDaysLocalTime(8);
	//current.u_authorize_termination_email_sent=termLetter;

})(current, previous);

Even with it commented out, I get the same error repeating when I try to create a case using the HR Service that goes with this BR. I have seen some stuff on the SN Comm talking about current.update - But I don't have that exact script being used. Can someone help me out as to why this error is occuring?

u_authorize_termination_email_sent field is new as of today for this also

Cheers,

-Rob

1 ACCEPTED SOLUTION

Found the issue - system property sn_hr_core.auto_categorization. When I was trying to test by making a LOA Claim case, I was getting those errors I showed in my initial post. The second error "failed to insert record" had me thinking that no case was created. This morning I logged in and saw 9 "test" cases created by me from last yesterday. For some reason when I was trying to create a case using LOA Claim service, the cases were being created under General Inquiry service, using the Total Rewards numbering system and short description.

find_real_file.png

So, these cases were created under the main HR Case COE - Really odd!!

When I jump into one of the cases, I see the following under activities:

find_real_file.png

That makes no sense - if I am selecting the actual service from the Case Creation Page, why would this property kick in to "help".

I went to the property and changed the value to false - created the LOA Claim case just fine. I think I read somewhere that this property has a flaw, and was fixed in Orlando (but I could be wrong and thinking about something else).

Either way, things seem to be working normal now that the property is set to false.

Thanks,

-Rob

View solution in original post

10 REPLIES 10

Checking the error logs that would have been created by me - pretty long, but this is what comes up:

FAILED TRYING TO EXECUTE ON CONNECTION glide.22 (connpid=3461305): INSERT INTO task (`made_sla`,`upon_reject`,`sys_updated_on`,`a_int_5`,`a_int_1`,`number`,`sys_updated_by`,`opened_by`,`a_bln_6`,`a_bln_7`,`sys_created_on`,`sys_domain`,`a_ref_17`,`state`,`sys_created_by`,`knowledge`,`a_bln_20`,`a_bln_10`,`a_num_1`,`a_str_16`,`a_bln_1`,`impact`,`a_ref_6`,`a_num_4`,`active`,`a_str_36`,`priority`,`sys_domain_path`,`a_ref_13`,`a_bln_8`,`opened_at`,`a_bln_9`,`approval_set`,`a_str_13`,`a_str_32`,`work_notes`,`a_ref_9`,`short_description`,`assignment_group`,`description`,`a_ref_15`,`calendar_duration`,`a_bln_4`,`sys_class_name`,`sys_id`,`contact_type`,`a_bln_3`,`urgency`,`company`,`reassignment_count`,`a_ref_2`,`activity_due`,`approval`,`a_ref_10`,`sys_mod_count`,`a_bln_5`,`a_num_6`,`a_int_3`,`a_bln_19`,`escalation`,`upon_approval`,`location`,`a_str_39`,`a_ref_19`) VALUES(1,'cancel','2020-06-24 19:53:36',0,0,'TRW0111983','142655','a9594a89dbdb5300305efb051d9619d4',1,1,'2020-06-24 19:53:36','global','c89d4eb91be4f3c0c275a7d4bd4bcb15',10,'142655',0,0,0,0,'6628cde49f331200d9011977677fcf0b',0,3,'6d6b29769f1322003be01050a57fcffa',0,1,'english',4,'/','9fd9f60d9f321200d9011977677fcf55',0,'2020-06-24 19:53:36',0,NULL,NULL,'yes',NULL,'e8ccf4cadbf63f00ebee8d3748961968','Leave of Absence Claim','29c010d5db3253403171dd1b5e9619f1','test','7e8d8ab91be4f3c0c275a7d4bd4bcb87',NULL,0,'sn_hr_core_case','be31c52a1ba1d8103c05fd13cd4bcb56','email',0,3,NULL,0,'f44922bf1b74141093e2dc68ec4bcbe9','2020-07-07 19:53:36','not requested','7e8d8ab91be4f3c0c275a7d4bd4bcb87',0,0,0,0,0,0,'proceed','c20300f8dbdf1300305efb051d961921','not_needed','c89d4eb91be4f3c0c275a7d4bd4bcb15') /* cswgprod005, gs:AFE3A4221B2D98103C05FD13CD4BCB9D, tx:3631c52a1ba1d8103c05fd13cd4bcbfe */
Unique Key violation detected by database ((conn=3461305) Duplicate entry 'be31c52a1ba1d8103c05fd13cd4bcb56' for key 'PRIMARY')
: java.sql.SQLIntegrityConstraintViolationException: (conn=3461305) Duplicate entry 'be31c52a1ba1d8103c05fd13cd4bcb56' for key 'PRIMARY': org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:229)
org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:165)
org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:239)
org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:361)
org.mariadb.jdbc.MariaDbStatement.execute(MariaDbStatement.java:412)
sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
com.glide.db.StatementWrapper.invoke(StatementWrapper.java:44)
com.sun.proxy.$Proxy12.execute(Unknown Source)
com.glide.db.DBI.executeStatement0(DBI.java:1131)
com.glide.db.DBI.executeStatement(DBI.java:1087)
com.glide.db.DBI.executeStatement(DBI.java:1040)
com.glide.db.DBAction.executeAsResultSet(DBAction.java:289)
com.glide.db.DBCompositeAction.executeAsResultSet(DBCompositeAction.java:178)
com.glide.db.DBCompositeAction.executeChunk(DBCompositeAction.java:138)
com.glide.db.DBCompositeAction.executeAsResultSet0(DBCompositeAction.java:100)
com.glide.db.DBAction.executeAndReturnTable(DBAction.java:252)
com.glide.db.DBAction.executeNormal(DBAction.java:241)
com.glide.db.DBAction.executeAndReturnException(DBAction.java:195)
com.glide.script.GlideRecordITable.insert(GlideRecordITable.java:158)
com.glide.script.GlideRecord.insert(GlideRecord.java:4913)
com.glide.script.GlideRecord.insert(GlideRecord.java:4823)
com.glide.script.GlideRecord.jsFunction_update(GlideRecord.java:4235)
com.glide.script.fencing.ScopedGlideRecord.jsFunction_update(ScopedGlideRecord.java:196)
sun.reflect.GeneratedMethodAccessor922.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.mozilla.javascript.MemberBox.invoke(MemberBox.java:138)
org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:670)
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:614)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2582)
org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:85)
org.mozilla.javascript.gen.sys_script_5e707273dbe05300c774594e5e9619a4_script_116551._c_executeRule_1(sys_script.5e707273dbe05300c774594e5e9619a4.script:9)
org.mozilla.javascript.gen.sys_script_5e707273dbe05300c774594e5e9619a4_script_116551.call(sys_script.5e707273dbe05300c774594e5e9619a4.script)
org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2651)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
org.mozilla.javascript.gen.sys_script_5e707273dbe05300c774594e5e9619a4_script_116551._c_script_0(sys_script.5e707273dbe05300c774594e5e9619a4.script:1)
org.mozilla.javascript.gen.sys_script_5e707273dbe05300c774594e5e9619a4_script_116551.call(sys_script.5e707273dbe05300c774594e5e9619a4.script)
org.mozilla.javascript.gen.sys_script_5e707273dbe05300c774594e5e9619a4_script_116551.exec(sys_script.5e707273dbe05300c774594e5e9619a4.script)
com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:279)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:118)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:82)
com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:309)
com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:214)
com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:201)
com.glide.script.BusinessRule.runScript(BusinessRule.java:410)
com.glide.script.BusinessRule.runSyncBusinessRule(BusinessRule.java:293)
com.glide.script.BusinessRule.runBusinessRule(BusinessRule.java:204)
com.glide.script.BusinessRule.run(BusinessRule.java:180)
com.glide.script.GlideRecordBusinessRules.run(GlideRecordBusinessRules.java:95)
com.glide.script.GlideRecord.runScripts(GlideRecord.java:1377)
com.glide.script.GlideRecord.runScriptsAndEngines(GlideRecord.java:1319)
com.glide.script.GlideRecord.insert(GlideRecord.java:4893)
com.glide.script.GlideRecord.insert(GlideRecord.java:4823)
com.glide.script.GlideRecord.ensureCorrectClass(GlideRecord.java:5162)
com.glide.script.GlideRecord.insert(GlideRecord.java:4898)
com.glide.script.GlideRecordSecure.insert(GlideRecordSecure.java:547)
com.glide.script.GlideRecord.insert(GlideRecord.java:4823)
com.glide.script.GlideRecord.jsFunction_insert(GlideRecord.java:5332)
com.glide.script.fencing.ScopedGlideRecord.jsFunction_insert(ScopedGlideRecord.java:162)
sun.reflect.GeneratedMethodAccessor908.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.mozilla.javascript.MemberBox.invoke(MemberBox.java:138)
org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:670)
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:614)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2582)
org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:85)
org.mozilla.javascript.gen.sys_script_include_687d7d8deb6f3200a9e7e26ac106fee0_script_3158._c_anonymous_25(sys_script_include.687d7d8deb6f3200a9e7e26ac106fee0.script:1078)
org.mozilla.javascript.gen.sys_script_include_687d7d8deb6f3200a9e7e26ac106fee0_script_3158.call(sys_script_include.687d7d8deb6f3200a9e7e26ac106fee0.script)
org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2651)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
org.mozilla.javascript.gen.sys_ws_operation_a059aa81eb440300a9e7e26ac106fe0a_operation_script_10285._c_process_1(sys_ws_operation.a059aa81eb440300a9e7e26ac106fe0a.operation_script:4)
org.mozilla.javascript.gen.sys_ws_operation_a059aa81eb440300a9e7e26ac106fe0a_operation_script_10285.call(sys_ws_operation.a059aa81eb440300a9e7e26ac106fe0a.operation_script)
org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2651)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
org.mozilla.javascript.gen.sys_ws_operation_a059aa81eb440300a9e7e26ac106fe0a_operation_script_10285._c_script_0(sys_ws_operation.a059aa81eb440300a9e7e26ac106fe0a.operation_script:1)
org.mozilla.javascript.gen.sys_ws_operation_a059aa81eb440300a9e7e26ac106fe0a_operation_script_10285.call(sys_ws_operation.a059aa81eb440300a9e7e26ac106fe0a.operation_script)
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:563)
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3429)
org.mozilla.javascript.gen.sys_ws_operation_a059aa81eb440300a9e7e26ac106fe0a_operation_script_10285.call(sys_ws_operation.a059aa81eb440300a9e7e26ac106fe0a.operation_script)
org.mozilla.javascript.gen.sys_ws_operation_a059aa81eb440300a9e7e26ac106fe0a_operation_script_10285.exec(sys_ws_operation.a059aa81eb440300a9e7e26ac106fe0a.operation_script)
com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:279)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:118)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:82)
com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:309)
com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:214)
com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:201)
com.glide.rest.service.custom.CustomService.runScript(CustomService.java:96)
com.glide.rest.service.custom.CustomService.execute(CustomService.java:83)
com.glide.rest.handler.impl.ServiceHandlerImpl.invokeService(ServiceHandlerImpl.java:37)
com.glide.rest.processors.RESTAPIProcessor.process(RESTAPIProcessor.java:290)
com.glide.processors.AProcessor.runProcessor(AProcessor.java:553)
com.glide.processors.AProcessor.processTransaction(AProcessor.java:240)
com.glide.processors.ProcessorRegistry.process0(ProcessorRegistry.java:177)
com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:166)
com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:31)
com.glide.sys.Transaction.run(Transaction.java:2192)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)

Yeah, definitely quite odd.

So this error pops up when it's trying to add another record to the database but the sys_id or a field that is listed as "unique" tries to create a duplicate.

So if there's any field on this table that is tagged as "unique" in dictionary or somehow the sys_id is trying to be the same, you'll see this type of error.

what's weird is that you even made the BR inactive, so if you didn't touch anything else, I'm not sure how this is even popping up today. If you added a new field...try to make it inactive? Just to see if that stops it?

Basically, try to make inactive anything you did recently and slowly reactivate each piece by piece.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hmm - yeah, there are no fields on the total rewards table that are true for being 'unique'.

I also found out that the requirements for that field placement were wrong. First it was asked to be on the LOA Claim Service - which had me confused. When I caught that, they corrected themselves and said it needed to be with our Three Letter Process HR Service.

Once corrected, everything is fine when using the Three Letter Process service - however, I still get the error when trying to create a LOA Claim case from scratch.

So, this might be an instance issue rather than any work I did today.

This is frustrating...

Still going to research though - that error, like you said, is really odd to be popping up.

-Rob

Yeah, sorry, unfortunately, I'm unable to follow what all you're saying as you know the situation and we really don't.

You could try to clear your instance cache by typing: cache.do and press enter in left-hand navigation.

Otherwise, I'm not sure, sort of lost now as to what all you have going on. Sorry.

Please mark any reply as Helpful, if it was, and the Correct answer as Correct. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

No worries at all, Allen. You've helped me plenty! I always enjoy talking things through with you as we have today and in the past. I appreciate your time as always! At least we know there's definitely an odd error happening here. Cheers bud!