I want to delete the records in incident table whose state is set to closed complete state

kiran hirebidar
Giga Contributor

Hi I have a requirement to delete all the records which are set to close complete state in incident table using scripting 

can anyone help me with the code . 

2 REPLIES 2

piyushsain
Tera Guru
Tera Guru

Hi,

Please create a fix script and run the script

var inc = new GlideRecord('incident');
inc.addQuery('state','')//add value of closed complete
inc.query();
inc.deleteMultiple();
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Piyush Sain

ersureshbe
Giga Sage
Giga Sage

Hi, Delete the record is not advisable. You can set active true to false and disable the visibility. 

Regards,
Suresh.