Restrict the deletion of attachment

Tanya10
Tera Contributor

Hi ,
I have a requirement to restrict deletion of attachment post submission of request for particular catalog item.
I followed this -https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0825743
It works well, but on portal even though attachment is not deleted it adds an additional comment saying deleted attachment

Tanya10_0-1762407072238.png

 

7 REPLIES 7

@Tanya10 

can you try Creating Fresh Table.None DELETE ACL on sys_attachment?

if user fails ACL then delete/cross icon won't be shown

Ensure none of the existing DELETE ACLs pass for sc_req_item

-> add this in condition of existing Table.None DELETE ACLs, so that they don't allow DELETE

AnkurBawiskar_1-1762420862321.png

 

-> in the new ACL you create, use this script

var gr = new GlideRecord("sc_req_item");
gr.addQuery("cat_item.name", "XYZ");
gr.addQuery('sys_id', current.table_sys_id);
gr.query();
answer = !gr.hasNext();

AnkurBawiskar_0-1762420828593.png

 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar 
I did implement the same solution and added the condition on existing delete acl on attachment table but it doesn't work

@Tanya10 

try checking that widget and how it shows that cross icon

that will help you to restrict

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader