GlideRecord - hasAttachments()

Determines if the current record has any attachments.

Table 1. Parameters
Name Type Description
None
Table 2. Returns
Type Description
Boolean True if the current record has attachments, false otherwise.

//Check for attachments and add link if there are any
  var attachment_link = '';
  var rec = new GlideRecord('sc_req_item');
  rec.addQuery('sys_id', current.request_item);
  rec.query();
  if(rec.next()){
    if(rec.hasAttachments()){
      attachment_link = gs.getProperty('glide.servlet.uri') + rec.getLink();
    }    
  }