---
description: >-
  Returns a list of all the attachments of the current record. The list is
  ordered by id desc. so the newest documents will be the first you will find
  while iterating over the array.
---

# getAttachmentsForCurrentRecord

## Example Usages

### Example 1

```javascript
console.log(app.getAttachmentsForCurrentRecord());
```

### Example 2 Filtering

```javascript
let allAttachmentsForThisRecord = app.getAttachmentsForCurrentRecord();
let invoices = allAttachmentsForThisRecord.filter((singleAttachment) => {
  return singleAttachment.documentTypeId == 2;
}); //We assume, that there is just one invoice
let attachmentBlob = app.getAttachmentById(invoices[0].id);
app.printBlob(attachmentBlob);
```

### Return Values

The function returns a sorted list of attachments for the current record. The list is sorted in descending order based on the id properties of the attachments. If there are no attachments found for the current record, it still returns an empty array. Recall that an empty array is not equal to null.
