Notifications

6 views

Description

This article helps how to restrict users from deleting attachments in a specific table (eg. Requested Item)

Resolution

'Manage Attachments' popup on the record is a UI page of attachment removing of 'Remove' button will remove the button globally not specific to a table

To restrict users from delete attachment on a table can be achieved via a before delete business rule

Note: In this method, we're allowing users to click on remove button and attachment disappear with the UI behavior but when you reload the record attachment shows up( attachment was never deleted on the server-side as Business rule operation has aborted the action)

In below example, Before-Delete Businessrule restrict users other than Admin to abort in deleting the attachment on 'sc_req_item' table

Name: Restrict Delete attachment on RITM
Table: sys_attachment
Advanced: check
When: Before
Delete: check


Filter Condition: Table Name is sc_req_item

Script Conditon:

(function executeRule(current, previous /*null when async*/) {

// Add your code here

if(!gs.hasRole('admin')){

current.setAbortAction(true);

}
})(current, previous);

Article Information

Last Updated:2020-05-26 03:00:48
Published:2020-05-22