Restrict the deletion of attachment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
should not happen.
share steps to reproduce and which portal page etc is this
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
its esc portal and I have written 2 BR,one on attachment and another on attachment doc table.The BR are almost same just dot walking is differnt
var tableID = current.table_sys_id;
var tableName = 'sc_req_item';
var catalogName;
var grRequest = new GlideRecord(tableName);
if (grRequest.get(tableID)) {
catalogName = grRequest.getValue('cat_item');
if (catalogName == 'xyz') {
if (!gs.hasRole('admin')) {
gs.addInfoMessage("You are not allowed to delete attachments for this item.");
current.setAbortAction(true);
}
}
} else {
gs.print("Record not found.");
}- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
so you are stopping user from deletion of attachment?
is that user clicking on delete icon?
you didn't mention which portal page is this? form? ticket?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
that's correct.Page is ticket, user should not be able to delete from anywhere once request submitted.Let it be portal/native veiw
