Is it possible to delete activity log (additional comment/worknote) from incident Form.

abhisingh
Kilo Contributor

Is it possible to delete activity log (additional comment/worknote) from incident Form.

5 REPLIES 5

Sabrina10
Kilo Guru

It can be tricky because you have delete the entry in multiple places.     Here is a guru article that may be able to help you.




https://www.servicenowguru.com/system-definition/remove-activity-log-journal-entries/


Patrick DeCarl1
ServiceNow Employee
ServiceNow Employee

You will just need to delete the record(comment) from sys_history_line.   But ACL is setup to allow nobody to delete.   So you can do background script or change the ACL and own the change throughout upgrades.


anaghas
Tera Contributor

Hello,


Goto App Navigator and type: sys_history_line_list.do and find the sys_id of the activity you need to delete.



Go to Background scripts and run the below script.



var gr = new GlideRecord('sys_history_line')


gr.addQuery('sys_id','Enter the sysid of the record which your want to delete '); //Search for it from the sys_history_line table


gr.query();


if(gr.next()){


gr.deleteRecord();


}



This should do the work.



Please make sure you test it on your test environment first.


Why do you want to delete activity log ? These are not the best practice guide.