T

his post shows how you can easily create an attachment UI action for any form. The attachment capability is part of all forms in ServiceNow and is accessed via a paperclip icon in the top-right corner of the form. In some cases this icon may not be prominent enough for your end users. The simplest solution in that case is to set up a UI action button or link that performs the same function.


For this solution we’ll leverage the existing ‘saveAttachment’ function. This function requires a table name and a record sys_id value. The ‘getTableName’ and ‘getUniqueValue‘ client-side functions will help to identify those values. You can add this capability by creating a UI action that looks like this…

‘Save Attachment’ UI Action
Name: Save Attachment
Table: Any table of your choice (Probably Task)
Form Button: True
Client: True
Onclick:

saveAttachment(g_form.getTableName(), g_form.getUniqueValue());