What causes attachments to be deleted when the corresponding record is deleted?

Meloper
Kilo Sage

If i have an attachment attached to an incident and i delete that Incident, the Attachment will be deleted also?
Does someone of you know, how ?
And does this also delete the att from "Sys_attachment" or also from "Sys_attachment_docs" ?

1 ACCEPTED SOLUTION

amaradiswamy
Kilo Sage

Hi @Meloper 

Yes, the attachments will be deleted automatically if a record is deleted. I think this is happening through event generation, but I am not 100% sure.

 

If attachment is deleted then the references to this attachment in Sys_attachment_docs also will get deleted. This is controlled through cascade deletion rules.

 

https://docs.servicenow.com/bundle/xanadu-platform-administration/page/administer/field-administrati...

 

The sys_attachment_doc table has a field that links the records there to a sys_attachment record.  that field is named 'sys_attachment' it is a Reference field and has Reference Cascade Rule set to "Delete". OOB  That means when a sys_attachment record is deleted, any related records in sys_attachement_doc should also be deleted.

View solution in original post

2 REPLIES 2

Rajesh Mushke
Mega Sage
Mega Sage

Hi @Meloper,

 

It might be causing because of the Cascade Delete Rules so check if it related to this or not.

 

 



Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke

amaradiswamy
Kilo Sage

Hi @Meloper 

Yes, the attachments will be deleted automatically if a record is deleted. I think this is happening through event generation, but I am not 100% sure.

 

If attachment is deleted then the references to this attachment in Sys_attachment_docs also will get deleted. This is controlled through cascade deletion rules.

 

https://docs.servicenow.com/bundle/xanadu-platform-administration/page/administer/field-administrati...

 

The sys_attachment_doc table has a field that links the records there to a sys_attachment record.  that field is named 'sys_attachment' it is a Reference field and has Reference Cascade Rule set to "Delete". OOB  That means when a sys_attachment record is deleted, any related records in sys_attachement_doc should also be deleted.