Duplicate Task Number
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2024 02:20 AM
Hi ,
i have a requirement to update the duplicate task , incident , facilities request , request item
2 task have same id
how can i update them with unique id ? using script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2024 03:27 AM
Hello @avinashdubey103 ,
If your records contain id field with same id number, then you can write the below script in Background Script
to update id field.
var grupdateRecord=new GlideRecord('table_name');
grupdateRecord.addQuery('sys_id','sys_id_of_duplicate_record');
grupdateRecord.query();
if(grupdateRecord.next())
{
grupdateRecord.setValue('id','idnumber'); //in idnumber add the number that you want to give to the duplicate record
grupdateRecord.update();
}
Please mark my answer as helpful and correct if it resolves your issue.
Regards,
Namrata
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2024 03:29 AM
Hi @avinashdubey103,
Can you advise at which record level you have the duplicate?
I can then provide a script.
A handy API and method you can leverage is: global.NumberManager('table_name').getNextObjNumberPadded(); which will provile the next available number for the corresponding table.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie