How to Make Attachment as Readonly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2015 03:48 AM
Hi All,
Requirement is to make Attachment as read only based on condition. A logged in user can view the attachment, download the attachment however should not able to rename, delete or modify.
Please help me to achieve this.
- Labels:
-
Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2015 04:06 AM
Try using:
if (condition)
{
g_form.disableAttachments();
}
More info:
http://wiki.servicenow.com/index.php?title=GlideForm_%28g_form%29#disableAttachments&gsc.tab=0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2015 05:06 AM
There are ACLs on the sys_attachment table. Just restrict the ACLs to read and create (so they can add attachments), and give delete and write to the elevated users that can do this.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2016 09:25 AM
Hi Mike I have noticed that the attachments in our instance is only visible to the person that attached the file. I want the attachments to at least be able to be read by the approvers. I know that it is lying somewhere in the sys_attachment table, but I am not quite sure what to change. Here is the code that I see under the READ ACL for the sys attachment table:
getAttachmentReadAnswer();
function getAttachmentReadAnswer() {
if (current.table_name.nil())
return true;
// If the attachment is from live feed,
// grant it the read access
if (current.table_name == 'live_profile')
return true;
// Remove Prefix
var tableName = current.table_name;
var invisible_prefix = "invisible.";
if (tableName.startsWith("invisible."))
tableName = tableName.substring(10);
var parentRecord = new GlideRecord(tableName);
parentRecord.setWorkflow(false);
if (!parentRecord.get(current.table_sys_id)) {
if (current.sys_created_by.equals(gs.getUserName()))
return true;
return false;
}
return parentRecord.canRead();
}
Any help that you can provide would be most appreciative.