Duplicate Task Number

avinashdubey103
Tera Guru

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 

 

 

2 REPLIES 2

Namrata Ghorpad
Mega Sage
Mega Sage

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

 

 

 

Robbie
Kilo Patron
Kilo Patron

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