Notifications

103 views

Description

A no OOB business Rules cause the error below:

Unique Key violation detected by database ((conn=905588) Duplicate entry 'cae8a2b3db360854580e61f74b96197c' for key 'PRIMARY')
02:46:19 AM.476 GlideSession message was modified by sanitization. [message=Unique Key violation detected by database ((conn=905588) Duplicate entry 'cae8a2b3db360854580e61f74b96197c' for key 'PRIMARY')][sanitized=Unique Key violation detected by database ((conn=905588) Duplicate entry 'cae8a2b3db360854580e61f74b96197c' for key 'PRIMARY')]
log02:46:19 AM.480 FAILED TRYING TO EXECUTE ON CONNECTION glide.21 (connpid=905588): INSERT INTO task .....

Cause

Business Rule contains ritm.update() andi s updating the record itself (RITM) when it's created so this looks to be same situation as of current.update.

Resolution

As per best practices we should avoid .update and current.update() in before business rules, see documentation for future reference: How business rules work

Prevent recursive business rules

Avoid using current.update() in a business rule script. The update() method triggers business rules to run on the same table for insert and update operations, leading to a business rule calling itself over and over. Changes made in before business rules are automatically saved when all before business rules are complete, and after business rules are best used for updating related, not current, objects. When a recursive business rule is detected, the system stops it and logs the error in the system log. However, current.update() causes system performance issues and is never necessary.

Article Information

Last Updated:2020-02-21 05:13:54
Published:2020-02-21