11 Replies Latest reply on May 30, 2013 12:13 PM by Don400

    Getting Attachments into a Document Form

    JoshDBoyle Level 1
      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?
        • 1. Re: Getting Attachments into a Document Form
          JoshDBoyle Level 1
          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.
          • 2. Re: Getting Attachments into a Document Form
            Jasmin Charbonneau Level 4
            I believe the FileAttachments tags also requires a File node.

            This is an example coming from the documentation:



                 
                      
                      
                      What this file does
                 

                 



            Jasmin
            • 3. Re: Getting Attachments into a Document Form
              Srujan81

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

               

              Srujan

              • 4. Re: Getting Attachments into a Document Form
                Steve Bishop Level 2

                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);

                • 5. Re: Getting Attachments into a Document Form
                  Don400 Level 1

                  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.

                  • 6. Re: Getting Attachments into a Document Form
                    Don400 Level 1

                    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.

                    • 7. Re: Getting Attachments into a Document Form
                      8_BIT_PLATOON Level 1

                      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

                      • 8. Re: Getting Attachments into a Document Form
                        Don400 Level 1

                        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
                        
                        • 9. Re: Getting Attachments into a Document Form
                          8_BIT_PLATOON Level 1

                          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....

                          • 10. Re: Getting Attachments into a Document Form
                            Jasmin Charbonneau Level 4

                            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

                            • 11. Re: Getting Attachments into a Document Form
                              Don400 Level 1

                              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)