I want to change data about a table in ServiceNow.

M_Tomy
Tera Expert

Dear Expert

 

A user has created a duplicate record with the exact same data. I want to delete all records except the one with the most recent SysID when two or more identical records are found by narrowing down the conditions with two key items.

 

Since the number of records is very large, please provide me with a script for deletion.

 

Best regards.

1 ACCEPTED SOLUTION

Animesh Das2
Mega Sage

Hi @M_Tomy ,

 

Please have a look at the below community thread and adjust the script as per your requirement. Hope it helps.

Fix script to delete duplicate records 

 

If this address your question, please don't forget to mark this response correct by clicking on Accept as Solution and/or Kudos.

You may mark this helpful as well if it helps you.

Thanks, 

Animesh Das

View solution in original post

3 REPLIES 3

Animesh Das2
Mega Sage

Hi @M_Tomy ,

 

Please have a look at the below community thread and adjust the script as per your requirement. Hope it helps.

Fix script to delete duplicate records 

 

If this address your question, please don't forget to mark this response correct by clicking on Accept as Solution and/or Kudos.

You may mark this helpful as well if it helps you.

Thanks, 

Animesh Das

@Animesh Das2 

Thank you for your prompt reply.

 

I will try it after tomorrow.
Please give me some time.

 

Thank you in advance.

M_Tomy
Tera Expert

@Animesh Das2 

A member of my team just tried the method you suggested in the development environment.
It seems to delete the files without any problem.
Thank you very much for your help.

 

Thank you very much!