- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2022 01:42 AM
Hi all, I have a requirement to change the prefix of Auto number field in the table which I got from integration. I have tried working with changing the prefix in studio. But it is not giving me the correct output. I want to know what are the other ways to do this. The more ways possible the better result I can get. Thanks for responding to this question. Every answer is valuable in one way or other.
Can I know how to do this with the help of transform scripts
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2022 01:45 AM
Hi
there are two steps:
- Change the prefix over the module "Number maintenance"
- Write a fix script which replaces the old prefix with the new prefix in all existing records.
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2022 01:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2022 01:46 AM
Hi,
Navigate to System Defination ---> Number maintenance and check for respective table and change the prefix.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2022 02:12 AM
But I need to change existing records as well
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2022 02:20 AM
Hi,
For existing records, you have to update it by Backgroud scripts or fix scripts.
Try this sample scripts -
//Query for your table
var record = new GlideRecord('table_name');
record.query();
while(record.next()){
//Change the number prefix from 'OLD' to 'NEW'
record.number = rec.number.replace('OLD', 'NEW');
record.setWorkflow(false); //Do not run business rules
record.autoSysFields(false); //Do not update system fields
record.update();
}
Thanks,
Sagar Pagar