How to Control Attachments for RITMs After a Specific Status.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Is it possible to implement this using a Business Rule: prevent attachments from being added or deleted for RITM records of a specific catalog item when the state is Work in Progress or later?
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
43m ago
yes you can use before insert before delete business rule on sys_attachment
Before Delete and Before Insert
Condition: current.table_name == 'sc_req_item'
Script:
(function executeRule(current, previous /*null when async*/ ) {
var ritm = new GlideRecord('sc_req_item');
if (ritm.get(current.table_sys_id)) {
if (ritm.cat_item == 'YOUR_CATALOG_ITEM_SYS_ID' && ritm.state >= 2) { // 2 = Work in Progress
gs.addErrorMessage('Attachments cannot be added for this RITM in Work in Progress or later state.');
current.setAbortAction(true);
}
}
})(current, previous);
💡 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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader