Working with attachments - Riada-AB/InsightManager GitHub Wiki
This example shows how to:
- How to get all attachments from an object:
ArrayList<SimplifiedAttachmentBean>sourceAttachmentBeans = im.getAllObjectAttachmentBeans(sourceObjectKey)
- Filter out a specific one based on name:
sourceAttachmentBeans = sourceAttachmentBeans.findAll{it.originalFileName == fileName}
- Attaching the file to another object
SimplifiedAttachmentBean newSimplifiedAttachmentBean = im.addObjectAttachment(destinationObjectKey, file, fileName, "Moved from object:" + sourceObjectKey, true)
- Deleting the attachment from the original object
im.deleteObjectAttachment(beanToBeMoved)
See the complete code here