Disable Attachments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2024 08:40 AM
Hello, I would like to disable attachments on a RITM is the approval field is not set to Approved
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2024 08:56 AM
Hi @DreDay3000,
Create a new Business Rule:
When: Before
(function executeRule(current, previous /*null when async*/) {
var attachment = new GlideSysAttachment();
var attachments = attachment.getAttachments('sc_req_item', current.sys_id);
if (attachments.hasNext()) {
gs.addErrorMessage('Attachments cannot be added unless the approval is Approved.');
current.setAbortAction(true);
}
})(current, previous);
Thank you, please make helpful if you accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2024 08:58 AM
What do you mean by disable attachments?
Do you want to make sure no new attachments can be added?
OR
No Attachments can be removed (if attachments are already added)
Or
Just Hide All attachments added and no new attachments can be added
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2024 09:12 AM
users with or without the itil role can attach files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2024 09:23 AM
Your script looks good, except that 3 means Rejected (unless you changed that in your instance). The OOTB value for Approved is 2. Also note that for this to work, you need to add Approval field to the form layout.
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/