Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Can we delete the attachment in ServiceNow, I want to know is that best practice?

Srinivasu2
Tera Contributor

Hi Community,

 

I have created case form using Record producer on CSM Portal and attachments are passing from case to incident and vice versa

 

Client raised the below question:

 

*Attachment "Rabbit_1.jpeg" was uploaded to INC0031920 and then deleted. The image file is deleted from the INC comments as well but it still shows up in CS0001148. If I accidentally upload a file and then realized it is not the one I wanted to share, it should delete from all the places related to the INC*

 

Can we delete the attachment in ServiceNow, I want to know is that best practice?

 

Thanks,

Srinivasu

3 REPLIES 3

PratikK098
Tera Contributor

Hi @Srinivasu2, Yes we can delete the attachments from ServiceNow. There is sys_attachment table where all the attachment files are stored. so you can simply go the the table and enter the sys_id of the record in the Table Sys ID field. You will get all the files attached to that record then you can delete the file that you want.

jessica_hewitt
Tera Contributor

Hi @PratikK098 , I am still learning how things in ServiceNow function. If we delete an attachment from the attachments table, how can I tell if a cascade of deletions has happened? Is the message below meaning that the attachment will remove from other linked records? 

 

This is the message I receive when I go to delete an attachment from a KB created in 2020 (it's linked to 3 other records) - 

Info MessageDeleting data can cause unexpected cascade deletion. Preview the number of records that will be affected before continuing and change the conditions if needed. When ready, schedule deletion by specifying "Run at" value or click "Execute Now" link to execute immediately. A rollback context will be created after execution.

Thank you in advance!

Bert_c1
Kilo Patron

Seems you will need to review the 'Reference cascade rule' as described here:

Reference cascade rule  

for all tables that have a reference field to the sys_attachment table:

 

https://devXXXXXX.service-now.com/sys_dictionary_list.do?sysparm_query=internal_type%3Dreference%5Er...