- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2020 06:05 AM
How can we restrict a user from renaming attachments after change request has been approved. I have tried onload client script using function g_form.disableattachments() but it restricts users from deletion and uploading new attachment but it allows users to rename the existing attachment.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2020 04:57 AM
Hi Harsha,
You can use a before update query filtered on table name = change_request and file name changes.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var chgGR = new GlideRecord(current.table_name);
if(chgGR.get('sys_id',current.table_sys_id)){
if(chgGR.getValue('approval') == 'approved'){
current.setAbortAction(true);
gs.addErrorMessage(gs.getMessage("Attachment names can not be modified after a change request has been approved."));
}
}
})(current, previous);
If my reply helped with your issue please mark helpful 👍 and correct if your issue is now resolved. ✅
By doing so you help other community members find resolved questions which may relate to an issue they're having.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2020 04:57 AM
Hi Harsha,
You can use a before update query filtered on table name = change_request and file name changes.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var chgGR = new GlideRecord(current.table_name);
if(chgGR.get('sys_id',current.table_sys_id)){
if(chgGR.getValue('approval') == 'approved'){
current.setAbortAction(true);
gs.addErrorMessage(gs.getMessage("Attachment names can not be modified after a change request has been approved."));
}
}
})(current, previous);
If my reply helped with your issue please mark helpful 👍 and correct if your issue is now resolved. ✅
By doing so you help other community members find resolved questions which may relate to an issue they're having.