Business Rules on change inserting duplicate data into task_ci table resulting in: Duplicate Key Error when Business Rule condition customizedDescriptionModify script include: ChangeCollisionHelper from has a method: x which is used by Business Rules x and y. While the on update business rule checks if an entry already exists in its condition and the other is on insert, the condition on the update can be altered removing the check. The insert into task_ci should always have guard code that should not be split out so this fix prevents the database from throwing an error.Steps to Reproduce Remove the condition from Business Rule: Add CI to Affected CIs on change, then create or update a change request with a new Configuration Item in the change request form. FAILED TRYING TO EXECUTE ON CONNECTION glide.12 (connpid=72768): INSERT INTO task_ci (`sys_id`,`task`,`sys_updated_by`,`applied`,`sys_created_on`,`sys_mod_count`,`sys_updated_on`,`discovery_manually_triggered`,`discovery_state`,`ci_item`,`sys_created_by`,`manual_proposed_change`) VALUES('3c301134dbcb7010146d51fcd3961936','5bcf45f0dbcb7010146d51fcd3961989','52822',0,'2021-10-04 16:26:07',0,'2021-10-04 16:26:07',0,NULL,'6b2efbaf1bc0f050e7519759bc4bcb49','52822',0) /* fcbdev005, gs:7D09FBE0DB837010146D51FCD39619E0, tx:a830d578db8b7010146d51fcd39619ba */ Unique Key violation detected by database ((conn=72768) Duplicate entry '5bcf45f0dbcb7010146d51fcd3961989-6b2efbaf1bc0f050e7519759bc4bcb4' for key 'ajfeoxdi_index_task_affected')WorkaroundModify script include: ChangeCollisionHelper from: ChangeCollisionHelper.addCiToChangeAffectedCis = function(ci, changeId) { var affectedCiGR = new GlideRecord('task_ci'); affectedCiGR.task = changeId; affectedCiGR.ci_item = ci; affectedCiGR.insert(); }; To: ChangeCollisionHelper.addCiToChangeAffectedCis = function(ci, changeId) { if (JSUtil.nil(ci) || JSUtil.nil(changeId) || ChangeCollisionHelper.isCiInAffectedCis(ci, changeId)) return; var affectedCiGR = new GlideRecord('task_ci'); affectedCiGR.task = changeId; affectedCiGR.ci_item = ci; affectedCiGR.insert(); };Related Problem: PRB1530617