I have a dynamic number of pdf attachments as input from an adaptive form, and would like to merge all attached pdfs into a single pdf using DDX, then have it send separately with the Document of Record with the Send Email step. However I encountered an issue with the Send Email step with the following:
Caused by: com.adobe.granite.workflow.WorkflowException: GetPropertyValue failed as value corresponding to VARIABLE:attachments for type class java.lang.Object is NULL
The DDX is as follows:
<DDX xmlns="http://ns.adobe.com/DDX/1.0/"> <PDF result="Attachments.pdf"> <PDF source="fileAttachment"/> </PDF> </DDX>
Input map for invoke ddx:
The "attachment" path matches the output attachment folder of the adaptive form
The output document is saved into the "attachments" document variable
Send Email step with Document of Record and attachments document:
I am unsure why the value for attachments is NULL. Any help on this is appreciated, thank you!
EDIT - testing workflowuser's process:
The following is the dynamic table with file attachments. The ordering is PDFs 1,2,3,4, but the resultant PDF from the process gives ordering 2,3,4,1.
please log a support ticket with Adobe if you are having problems with 20 or more attachments in the form
Here is the latest bundle
I have increased the size of my query to 100
Your workflow step should look like this
Did you enable the log for the bundle?
check the logs it should give you more information
Are these attachments all pdf files?
your Data.xml should look something like this. It should have fileAttachment elements in it
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
just double click on the Data,xml file
in your crx go to
here is the updated bundle
I also removed the system.out.println statements and moved them to log.debug. If you want to see the logs you can enable debug logs for this bundle
the new bundle can be downloaded from here
In the process step we can specify the order in which you want the attachments to be assembled.In this screenshot attachment added to the field called idcard will be the first pdf followed by attachments added to the bankstatements which is a field in a table that can grow
I have a solution. Let me test it a little more before Icanngive it to you
Let us know if you have problems creating your own bundle
Ii could give you the ready to use bundle but would be better for you to try creating the bundle
i can definitely help you with the code
This document will help you get stated with creating your first OSGI bundle
you will need to familiarize your self with DDX for creating the bundle to accomplish your task
also take a look at the xml file in your payload folder in the crx
I recommend you to use a panel and in that panel let your users add the attachment. One file only
make that panel repeatable
so when the user submits the form grab the data.xml That holds your submitted data and iterate through the panels and create your ddx accordingly
Will your file names will always be the same?
either way this cannot be done without writing custom code
you will have to create the ddx with the pdf source elements in the right order then use that ddx to assemble the documents
let me check and get back to you
this will require custom code as the invoke ddx step may not be able to do the ordering that you want
Deploy and start the custom bundle and do the following. in your workflow drop process step component.( this will replace the invoke DDX step) associate the process with Assemble Task Attachments. this code assembles the PDF attachments of the Adaptive Form and stores it in a file called assembled-pdf.pdf under the payload folder. Create a variable called assembledPDF of type Document. Use the Set Variable component to initialize the variable as shown in the screen shot . You can use this variable in your send email step
Let me know if you have trouble getting this to work
In the meantime, I will investigate why the invoke DDX step is not working
BTW the code also writes the assembledpdf to the folder of your aem installation
are the form attachments getting assembled into one pdf?
Are you able to assemble secured pdf using Acrobat?
I have also added bookmarks to the assembled pdf
open the assembled pdf using Adobe reader and check the bookmarks
As a workaround have two repeating panel’s. The first panel you can allow users to add a maximum of say 12 attachments
In the second panel they can add another 8 attachments and submit the form
this is working for me
Is that a common use case of attaching 20 pdf files?