# getAttachmentById

## Parameters

id - id of the attachment

## Example Usages

```javascript
app.getAttachmentById(1234);
```

```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 Promise that will eventually resolve to either a Blob (if the fetch is successful) or null (if there is an error or the status is not 200).
