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.
Two records from different tables with the same name is causing ambiguity - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • Two records from different tables with the same name is causing ambiguity
KB0694571

Two records from different tables with the same name is causing ambiguity


2116 Views Last updated : Apr 7, 2024 public Copy Permalink
KB Summary by Now Assist

Issue

Two records from different tables with the same name is causing ambiguity

Release

All available releases

Cause

The number maintenance in the instance could be different from OOB ones. In out of the box instances, no two table would share the same prefix. Say prefix for the table task is TASK, SCTASK for catalog tasks, CHAT for chat queue entries etc. It might have been modified in the instance. Since these records are auto numbered this is expected. The user can verify the same by navigating to the following link and checking the prefixes for the tables. 

https://<instance-name>.service-now.com/sys_number_list.do

Resolution

In order to resolve the issue, the user need to have unique prefixes set for the affected tables. They can set the out of the box prefixes to avoid other ambiguities. To change the same, the user will need to edit the prefix values for the corresponding tables by going to the sys_number table.

In order to change the prefix of the existing records, one can make use of the following code in the background script. 

For example, to change sc_task records' prefix from TASK to SCTASK, the following script can be used.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//Query for the table records
var rec = new GlideRecord('sc_task'); 
rec.addEncodedQuery('numberSTARTSWITHTASK'); // Add this line so if you run this script again you will not affect already converted records.
rec.query();
while(rec.next()){
   //Change the number prefix from 'TASK' to 'SCTASK'
   rec.number = rec.number.replace('TASK', 'SCTASK');
   rec.setWorkflow(false); //Do not run business rules
   rec.autoSysFields(false); //Do not update system fields
   rec.update();
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

If you have a large amount of records to be adjusted you can run this in small batches, utilising the the setLimit function.
 
Add this before rec.query();
rec.setLimit(10000);
 
This will then only update 10000 records, then if after completed you run again it will go another 10000.
You can adjust this number to whatever works for you.

Related Links

Do not run the script on the production environment first. Ensure testing is first carried out on a developer instance. Only after verifying this is working as expected should you proceed to execute this in production.

 

If you have any worries please raise a case with Support and they will happily answer any questions or queries you may have.



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.