Restrict specific user to add attachment/delete the attachment when the case is in closed state
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2024 11:21 AM
The requirement is restrict the user that belongs to a specific group, they cannot add/delete the attachment for the closed case. What I already try is creating a new business rule in global application, modify it in Attachment table[sys_attachment], before insert and delete and with following script
(function executeRule(current, previous /*null when async*/) {
// retrieve parent record
gs.log('Business Rule has been triggered. Record: ' + current.number + " with table name?" + current.table_name);
var parentRecord = new GlideRecord(current.table_name);
if (parentRecord.get(current.table_sys_id)) {
// check case status is closed
if (parentRecord.getTableName() == 'sn_customerservice_case' && parentRecord.state == 'Closed') {
// check user is belong to specific user group
var userGroups = gs.getUser().getMyGroups();
var restrictedGroup = 'Store';
if (userGroups.indexOf(restrictedGroup) > -1) {
gs.addErrorMessage('You are not allowed to add or delete attachments when the case is closed.');
current.setAbortAction(true); // prevent to add/delete the attachment
}
}
}
})(current, previous);
But still the user still can add/delete the attachment for the closed case...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2024 03:05 PM
the way BR works.. however I need to modify the UI pages to hide the attachment icon and delete icon for the attachment part...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2024 12:40 PM
OK... it have the store support module, store support user cannot delete/add the attachment when the case closed. When I try is following :
And when I impersonate to the store user I still can see the attachment button and delete button..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2024 10:43 AM
Kind of urgent for this request.... it looks like somehow I need to change the stuff on service portals side? But now I really lost...