Page 1 of 1

Workflow Forms - Clickable Download/Preview Buttons for Email Attachments -

PostPosted:Tue Oct 21, 2025 7:05 am
by marius_i
Environment: OpenKM Community Edition

Hi,

I'm developing a workflow that processes emails with attachments. The workflow successfully extracts email content and detects attachments, but I'm struggling to implement clickable download/preview functionality within the workflow form.

What Works:

Email content extraction (from, subject, body, date)
Attachment detection and metadata (filename, size, UUID)
Basic workflow form display

What I'm Trying to Achieve:

Clickable "Download Attachment" button that directly downloads the file
Clickable "Preview Attachment" button that opens file preview
Similar functionality to the native OpenKM email properties interface

Current Implementation:
Code: Select all
<!-- forms.xml -->
<button name="downloadAttachment" label="Download Attachment" width="200px" style="download" transition="download"/>
<button name="previewAttachment" label="Preview Attachment" width="200px" style="view" transition="preview"/>

<!-- processdefinition.xml -->
<node name="download_attachment">
    <script>
        String attachmentUuid = (String) executionContext.getVariable("attachmentUuid");
        String downloadUrl = "/OpenKM/frontend/Download?uuid=" + attachmentUuid;
        // No way to trigger actual download from here
    </script>
    <transition to="afisare_formular"/>
</node>
Question:
Is there any way to make workflow form buttons trigger direct file downloads?

Thank you in advance for any guidance!

Marius

Re: Workflow Forms - Clickable Download/Preview Buttons for Email Attachments -

PostPosted:Tue Nov 04, 2025 9:28 am
by jllort
You should use the Download field https://docs.openkm.com/kcenter/view/ok ... field.html and mapping in the context by data attribute with an object of the same type created dynamically.