- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2024 01:34 AM
Hi All,
I have a requirement to restrict users from deleting attachments in a change ticket once the state changes to "Scheduled." However, users should still be able to add attachments in any state.
I have implemented a before/delete Business Rule, but it is not showing any error. The system allows the user to delete the attachment, and after the page refreshes, the document reappears. This partial behavior is confusing for the user. Although the attachment is not actually deleted, there is no error message, and the user only realizes the attachment wasn't deleted after the page refreshes. However, after clicking the remove button, it appears as if the attachment was removed.
I am looking for an approach where, if the user tries to remove an attachment after the state is "Scheduled," the system will throw an error.
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2024 10:18 AM
Can you share your business rule? Was your business rule on the attachment table?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2024 10:34 AM - edited 11-22-2024 10:35 AM
I got an ACL to work. I had to modify an OOB ACL to get it to work. As you can see from the screenshot below it removes the checkboxes next the the attachments and the remove button is not visible.
The ACL I modified can be found here https://[instance].service-now.com/nav_to.do?uri=sys_security_acl.do?sys_id=0c66472a0a0a0b82017c1f3df66a3fe7
I added the following code right after var tableName = current.table_name;
//Handel change request files
if (tableName == "change_request") {
var changeRequest = new GlideRecord('change_request');
if (changeRequest.get(current.getValue('table_sys_id'))) {
if (changeRequest.state >= -2) //Value of "Scheduled" state
{
return false;
} else {
return true;
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2024 10:18 AM
Can you share your business rule? Was your business rule on the attachment table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2024 11:35 PM
Hi ,
I have implemented a before/delete Business Rule on the sys_attachment table.
The condition I have provided is: current.getValue('table_name') == 'change_request';
The script is as follows:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2024 11:48 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 07:31 AM
Just want to make sure you don't need any further help. I noticed that your marked my answer a correct.