How to delete Work notes in ritm through script

sasikalathota98
Tera Contributor

I need to be delete the work notes on multiple RITM's. I am planning to use fix scripts , Can anyone provide solution to this. 

 

Thanks in advance.

3 REPLIES 3

Tai Vu
Kilo Patron
Kilo Patron

Hi @sasikalathota98 

Attach the below post for your reference.

How to remove undesired/unwanted comments from case record?

 

You can replace the query field name (element) from comments to work_notes. It should work as well.

 

Cheers,

Tai Vu

Prashant Ahire
Kilo Sage

Hello @sasikalathota98 

You can use this fix script 

 

var gr = new GlideRecord('sys_history_line')
gr.addQuery('sys_id','Wrire down the sysid of record of worknote');
gr.query();
if(gr.next()){
    gr.deleteRecord();
}

 

Please check and Mark Correct and Helpful if it really helps you.
Regards,
Prashant Ahire

Ankur Bawiskar
Tera Patron
Tera Patron

@sasikalathota98 

so what did you start with and where are you stuck?

on what parameter(older than 90 days etc) you would like to delete work notes in those RITMs?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader