How to delete comment or work notes from an incident task using Table API

ellinorM
Tera Contributor

Hi, 
I just started working with Servicenow. I have tried to find a easy way to delete a specific comment or work note from an incident via the Table API. I want to delete a comment using the comment ID/work note ID (sys_id) with the Table API from all tables needed. From what I understand there is three tables that I need to handle? 

sys_journal_field
sys_audit
sys_history_set


The problem is that the sys_id is different  in all tables and there is really no way of making sure that I delete the correct items? My code will have the incident sys_id and the comment/work note sys_id available when doing this operations. What is the best way to do this? 

7 REPLIES 7

Brian Lancaster
Tera Sage

Why do you need to delete so many comment / work notes that you need an API? I have been working with ServiceNow since 2014 and I have only been asked to delete comments / work note 2 time.

Currently we are working with replacing our CMS to Servicenow and we have the need of deleting comments in out business since before. So I'm trying to meet this need in our new CMS Servicebow.

We are replacing our CMS to Servicenow and we have this need since before in out business. I would like to investigate if there is a good way in Servicenow to meet this need as well or if I need to change the business logic and workflow.

This is the process for deleting comments / work notes in the system.

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0520375

I'm not sure how easy it would be to do it programmatically so I think it is change to business logic as there should be no reason to have to delete this info. When it comes down to it once a comment for example is added even if you delete it the customer already got an email with that comment. So to me it is not worth the error.