A different approach to attachments

General Add comments

One of our customers had the need to hide attachments under certain curcumstances on tickets. Now, with out of the box ServiceNow, the user can see all attachments if he has read access to the ticket. An additional demand was that they wanted to give their attachments a name (within ServiceNow).

Out of the box, it is not possible to name your attachments, and it’s not possible to customize the ‘Attachments’ functionality. So, we had to come up with some way to allow this.

Our solution to this problem was to add the related list for the attachments to the specific table. This will also allow you to use list control options for creating new attachments. After adding the related list, you can add a ‘name’ field to the dictionary. Don’t forget to add it to the list layout. Now, remember to check the list edit rights on your instance, otherwise it will not be possible to edit the name of your attachments.

As for hiding the attachments list, we need to put the following line of code in a client script. You can add your custom conditions to this line of code.


Now, this is not enough for hiding the attachments. The thing is, you are hiding the related list, but at the top of the ticket, the attachments are still displayed.
In order to hide this, an onLoad clientscript is necessary. The following script will hide the attachments bar for you:

function onLoad() {
if (gel('header_attachment') != null)
if (gel('header_attachment_line') != null)
if (gel('header_add_attachment') != null)

If you have any questions, please don’t hesitate to drop me an e-mail on .img[at].img

Leave a Reply