Show if a ticket has an attachment in the list view

Jason Guidry
Kilo Contributor

Hello all,

i am new to scripting and am learning as I go. Can someone tell me how to set up the task table to show all tasks that have attachments in the list view? Not sure what all i have to do to make this happen. 

Thanks in advance for the help

2 REPLIES 2

Swadesh Saraf2
Kilo Guru

You will need to create a field HasAttachment and set it to true or false accordingly.

You may find some useful information here:

https://community.servicenow.com/community?id=community_question&sys_id=f84043a1db98dbc01dcaf3231f96...

Adrian Ubeda
Mega Sage
Mega Sage

Hi, 

I think you'll have to create a dynamic filter for this, and call it inside an application menu if you want to create a direct link from left menu to apply over that table with that condition.

Your code inside script include for recovering sys_ids of task with attachment, should look as follows:

var array = [];

var gr= new GlideRecord('task');
  gr.query();
  while(gr.next()){
    if(gr.hasAttachments()){
      array.push(gr.sys_id);
    }    
  }
return 'sys_idIN' + array.join();

and also for calling you dynamic filter use: javascript: newScriptIncludeName().function();

If it was helpful, please give positive feedback.

Thanks, 

If it was helpful, please give positive feedback! ✔
☆ Community Rising Star 22, 23 & 24 ☆