Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
Method update() in Business Rule causing Unique Key violation detected by database - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • Method update() in Business Rule causing Unique Key violation detected by database
KB0813944

Method update() in Business Rule causing Unique Key violation detected by database


6460 Views Last updated : May 14, 2025 public Copy Permalink
KB Summary by Now Assist

Issue

A custom Business Rules causes 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 RITM record itself when it is being created, so being the same situation as of current.update.

Resolution

As per best practices, avoid .update and current.update() in before business rules, to avoid recursive calls.

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.

Related Links

See documentation for future reference: How business rules work


The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.