Purging specific attachments on a record

Zstromsodt
Tera Contributor

Hello!

 

I attempted to locate any information about purging specific attachments from a record and didn't find much luck so i'm reaching out here.

 

I was curious to know if anyone on this forum has purged any attachments from a record and how they went about doing so. 

 

Ideally would like to be able to have the agent choose which attachments gets purged and leave a lovely 'No longer here' message in the activity notes.

 

Thanks!

1 ACCEPTED SOLUTION

If you like, indeed you can have a script run when a user is trying to delete an attachment via the UI. All you need for that is a "before delete" business rule on Attachment [sys_attachment] table that would send the file to your other system just before it gets deleted from ServiceNow. However, if that's not the desired approach, you can also do that via a scheduled job.

View solution in original post

4 REPLIES 4

Slava Savitsky
Giga Sage

I am not sure I fully understand your question. Attachments can be deleted by users via the UI or you can delete them via a script. You can also configure the system to record the fact of attachment deletion in the work notes, for example. What is your current situation? And what is the exact problem? Are certain users unable to delete certain attachments?

Mostly looking to get some advice on pitfalls to look out for when designing. Definitely understand that it can.

 

Ideally we would want the system to remove the files via a scheduled job that would send it to a Mid Server File to be picked up by another solution. 

 

Unless you're implying that by having hte users delete via the UI it can trigger a script to move the deleted file elsewhere. 

If you like, indeed you can have a script run when a user is trying to delete an attachment via the UI. All you need for that is a "before delete" business rule on Attachment [sys_attachment] table that would send the file to your other system just before it gets deleted from ServiceNow. However, if that's not the desired approach, you can also do that via a scheduled job.

Fantastic, thanks slava. When I get this rolled out, i'll try to put some documenation here so others can benefit.