Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Getting Attachments into a Document Form

Avatar

Former Community Member
All



I am in need of a way to get various files into a Document Form as attachments. I have a list of documents which contains the files I want to attach and a means to convert this list to a map if necessary.



I am aware of the invokeDDX service but am unable to get it to work. Could somebody please clarify for me how to go getting these files into the Document Form as attachments?
11 Replies

Avatar

Former Community Member
Here is the DDX I have created within my workflow:









However, invokeDDX errors out stating that the DDX "did not pass validation against the specification".

Would someone be so kind as to clarify what this means and what is wrong with the DDX above?

Test.PDF is the name of the first attachment
Remaining Bugs.txt is the name of the second attachment
SAPTransport.pdf is the name of the PDF document I want to put the above two attachments in
AfterAttachments.pdf is an arbitrary name for the resultant document.

Avatar

Level 10
I believe the FileAttachments tags also requires a File node.

This is an example coming from the documentation:






What this file does





Jasmin

Avatar

Former Community Member

I have same type of problem can you tell me the solution?

Srujan

Avatar

Former Community Member

Here is my execute script code to convert a list of attachments to a map of attachments which you can then pass to a Render step:

import java.util.HashMap;

import java.util.List;

import java.util.Map;

import java.util.Iterator;

import com.adobe.idp.Document;

List attachmentList = patExecContext.getProcessDataListValue("/process_data/lsAttachments");

Map attachmentMap = new HashMap();

Iterator it = attachmentList.iterator();

while(it.hasNext()){

          Document attDoc = (Document) it.next();

          String name = (String) attDoc.getAttribute("name");

          attachmentMap.put(name, attDoc);

}

patExecContext.setProcessDataMapValue("/process_data/mapAttachments",attachmentMap);

attachmentList.clear();

patExecContext.setProcessDataListValue("/process_data/lsAttachments", attachmentList);

Avatar

Level 3

I have an archive file with three processes that take a map of documents and converts it to a portfolio (the map keys are the document names).  One of the processes builds the DDX file from the map keys and an input variable for the portfolio name.  I don't know where to post it but send me an email and I'll attach it to my reply.

Avatar

Level 3

Steve, where do you put adobe-livecycle-client.jar in you app server?  I tried putting it in LC_HOME\jboss\server\lc_turnkey\lib and get a java.lang.LinkageError.  See this discussion thread for stack traces.

Avatar

Level 2

So I assume you have LC Forms then:

Then simply use the LC Forms RenderForm component (check the "ALL" properties), one of them is an attachment list/map.

You sorted

Have fun.

Luigi

Avatar

Level 3

When I do that LC throws an exception the gist of which is the following:

Caused by: ALC-DSC-119-000: com.adobe.idp.dsc.util.InvalidCoercionException: Cannot coerce object: {...} of type: java.util.HashMap to type: class com.adobe.idp.Document

Avatar

Level 2

I can't remember if it is a map or list.... that is required in the input, however... you can see that...

but make sure the sub-type of the attachment/map is a "document" type.

when i get back onto workbench... i'll give full full details....

Avatar

Level 10

The error says you're putting a Document variable where it expects a Map (or maybe a list).

Are you sure you're using the right data type?

Jasmin

Avatar

Level 3

Jasmin, yes that's correct.  I should have stated the exection environment.  In Steve's Feb 25 post he stated

Here is my execute script code to convert a list of attachments to a map of attachments which you can then pass to a Render step:

I re-read that a few days ago and thought, "Oh, I wonder if he means the Render step as in the FormsService/renderPDFForm process?"  So I created a map variable (sub-type document) and populated it with a few documents and then attempted to execute the renderPDFForm process with no form and the form data set to the map<document> object.  That's what generated the InvalidCoercionException.

So going back to Steve's Feb 25 post, I can't understand what 'Render' step is being referenced.  I know you can pass a list of documents as an attachment list in the UserServiceV2 'Assign Task' process (but you can't pass a map of documents because the 'Assign Task' Attachments UI only displays lists, nothing else).

As I mentioned in an earlier post above, I have a process that parses a map of documents and generates the DDX as an XML variable which can be passed to the AssemblerService 'Invoke DDX' process (which actually requires a map of documents as one of the inputs).

Message was edited by: Don400 (fixed a typo and made minor readability improvements)

Message was edited by: Don400 (to re-address the post and clean up associated subject references)