JavaScript method: SCFile.getAttachments()

This method gets all of the attachments associated with the current file record.

Before calling getAttachments, you must establish a current record using one of the positioning methods, such as doSelect(), getNext(), etc.

Syntax

SCFile_object.getAttachments()

Arguments

The getAttachments method takes no arguments.

Return values

If successful, getAttachments() returns an array of attachment objects. The array will be empty if there are no attachments for the record. The attachment objects retrieve here will only contain metadata. The Attachment.value will be NULL. To get each attachment's binary data, you will need to use SCFile.getAttachment(attachID) method where attachID contains the href property of the attachment object.

Example

This example does the following:

  • Selects one record from the probsummary table
  • Gets all of the attachments associated with the current record

This example requires the following sample data:

  • Record number IM10001 in the probsummary table

var f = new SCFile( 'probsummary' );
    
var rc = f.doSelect( 'number = "IM10001"' );
    
var attachments = f.getAttachments();

     print( attachments.length );
     for ( var attachment in attachments )
     {
         print( attachments[ attachment ].name );
     }