Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

How to get Form's Attachment File


Former Community Member

I want to get form's attachment file and write them on disk. I found "writeDocument" to write on disk but I don't know how to get form's attachment file (This attachment file is added in the workspace with the tab attachment file, beside the form tab).

6 Replies


Level 10
Are they added by a user at a user step in the workflow or when you first initiate the form.

If they're added by a user at a user step in your process, you can use the "Output Attachment" property of the "Attachment and Notes" tab to store them in a list.

If they're added when you first initiate the form, we'll have to use some script in the script service to extract them from the task.



Former Community Member
For information about saving attachments that are added at a user step in the process, here's the topic in Workbench ES Help:




Level 9
Hi Siham

We have components for manipulating attachments, and for saving them to directories (including the initial step of a workflow).

These haven't been released yet (we're working on a release within the next 2 weeks), but if you'd like early access, please email info-at-avoka.com, and we'll organize you a beta copy.




Former Community Member
In response to question about getting attachments from Form

Jasmin Charbonneau, "How to get Form's Attachment File" #1, 21 Aug 2008 4:14 am

it is said that I have to use some script to extract them if they are added during form initiation.

I'm not able to find any help or reference how to do that, where do I look, is there some implicit object I can use, is there a global function or service that I could use to access those attachments?

I know that I will have those initiating attachments in the next user task if I select 'Copy all attachments and notes from previous task' but I need to access them before that.

Any help is appreciated, even just which part of documentation I need to search to find answer.


Former Community Member

Take a look at this post

let me know if you need any more help




Former Community Member

gbedekar (the above poster) has a component on his blog (eslifeline.wordpress.com) with which you can pass in a TaskID and get all the attachments within that task. I'd take a look at it!

Conversely, you can simply use the built-in functionality of the Assign Task (user) service to store any attachments in a list.

Let me know if you have any questions.

Josh Boyle


Cardinal Solutions Group