Expand my Community achievements bar.

Question about Email Receiver QPAC

Avatar

Former Community Member
I've got a question about using the email receiver QPAC and how attachments are loaded. I'm using the Email w/ Attachments QPAC to send a PDF form to a user who does not have Form Manager access. On that form I've included an email submit button which sends the form data as XDP back to an Inbox that I am monitoring with the Email Receiver QPAC. What's the best strategy for importing the XDP attachment back into a form process variable ? Do I simply point the attachment location to the form variable ?



Is there any more info on how attachments can be mapped to process variables ? For instance, if the email has an image or text file attached, can their contents be mapped to another process variable (e.g. binary or string). The doc doesn't say much on how this occurs.



Thanks
15 Replies

Avatar

Level 9
Hi Rob



I believe you can simply map the attachment back to the form variable, and it should just override the original one. This assumes that you are attaching the XDP file rather than an XML file to the email in your Submit button.



If the email contains multiple attachments, you can retrieve all of them. You simply add extra lines to the list of attachments. The behavior of the Email Receiver is:

- If you specify neither the name nor the mime type, it will simply find the first attachment, and insert it into the first variable, the second attachment into the second variable, etc.

- If you specify a name and/or mime type, it will look for an attachment with that name/mime-type. If it finds a match, it will insert that attachment into the specified variable. If it doesn't find a match, it will leave that variable blank, and search for the next matching attachment.



So if you know either the:

- name

- mime type

- or order

of the attachments in your email, you can find individual attachments quite easily.



The major complication is that it's quite difficult to know what the mime types and names of attachments are. This is why there is a test tab. You can use the test tab to retrieve an exising sample email, and find out what it's attachments are.



In order to use the Test tab, you have to add the javamail apis to your Workflow Designer classpath. See another thread on this issue:


Howard Treisman, "EmailReceiver Qpac testing-tab" #18, 19 Dec 2005 12:49 pm



A further complication is that different email clients
may attach the same attachments with different mime-types and/or order. You just have to experiment.



I hope this is helpful.



Regards,

Howard

http://www.avoka.com

Avatar

Former Community Member
Has anyone gotten this to work successfully ? I've been experimenting with this all day with mixed results, none of which are right. When I map the XDP attachment to a form variable (e.g. /process_data/FormVar) I get the following stack dump....



16:50:53,786 INFO [STDOUT] com.adobe.workflow.datatype.InvalidCoercionException

: Cannot coerce object: com.sun.mail.util.QPDecoderStream@1e01a1a of type: com.sun.mail.util.QPDecoderStream to type: com.adobe.workflow.datatype.form.FormDataTypeInstance

16:50:53,786 INFO [STDOUT] at com.adobe.workflow.datatype.form.FormDataHandler.coerceFrom(FormDataHandler.java:220)



Looking at the code for the email receiver QPAC it appears to call com.adobe.workflow.pat.service.PATExecutionContext.setProcessDataValue() to set the target variable from the attachment data. The only doc for that call is that it's used to set the value of a process object.



Other attempts to set /process_data/FormVar/form-data/data/xdp or sending back XML and setting /process_data/FormVar/form-data/data/xdp/datasets/data didn't crash, but didn't produce the expected result either.



Any help would be greatly appreciated.

Avatar

Former Community Member
I could really use some guidance on someone who has successfully used the Email Receiver QPAC to load a received attachment back into a form or document variable. I've done numerous experiments with no success. If I try to load a received xdp into the formVar I get the error....



com.adobe.workflow.datatype.InvalidCoercionException

: Cannot coerce object: com.sun.mail.util.QPDecoderStream@1e01a1a of type: com.sun.mail.util.QPDecoderStream to type: com.adobe.workflow.datatype.form.FormDataTypeInstance



If I try to load a received PDF into a document variable, I get the error ...



com.adobe.workflow.datatype.InvalidCoercionException

: Cannot coerce object: com.sun.mail.util.BASE64DecoderStream@b949da of type: com.sun.mail.util.BASE64DecoderStream to type: java.lang.Byte



Surely I'm missing something obvious. I'm running WF 7.0 under JBoss 3.2.5 and JDK 1.4.2_09

Avatar

Former Community Member
Hi

I have used the email receiver qpac.It is very straightforward to use.You need a process variable of type document defined and then you configure the email receiver qpac to look for the specific email and map the attachment of the email message to the document variable you defined. Also make sure you have not set the mime type in the attachment tab of the email receiver qpac.

let me know how it goes

Avatar

Former Community Member
Could you tell me what version of the EmailReceiver QPAC you have ? If you select the QPAC in WF Designer, right click, and select Component Properties, there is a Info tab that lists the version and spec version.



And fyi - I also tried loading a pdf attachment to a binary variable and got the same error as when I attempted to load it to a document. It appears to have a problem mapping the attachment stream to the process variable object.



I have tried this with a brain dead simple workflow and can't seem to have any luck. I understand completely how the EmailReceiver works, I just can't it to work in practice...



For clarity, here's what I have...



1. My workflow consists of an EmailSender w/ Attachments QPAC that emails the submitted form to someone. The form's FSTYPE is set to PDF and I've setup an init form pointing to the xdp, etc.



2. I have a process document variable called 'pdfSubmit' with the 'in' attribute set so that it receives the init form PDF.



3. I then have a Email w/ Attachment QPAC that emails a user with a PDF attachment defined pointing to the 'pdfSubmit' variable. The sender account is the same one I'm monitoring below (and not the std workflow server acct)



... everything works fine up to this point.. the email is sent with the PDF as expected...



4. I then have a EmailReceiver QPAC monitoring a POP3 account and looking for a message with a certain subject. It then looks for an attachment called 'tryit.pdf' and attempts to store it in a document process variable called 'pdfRec'



5. The user who received the PDF, fills it out and attaches it to a reply, calling it 'tryit.pdf'



6. The EmailReceiver QPAC detects the message and attachment correctly but bombs out when attemtping to map the attachment as described above.



I'm losing hair over this one :)



Thanks

Avatar

Former Community Member
I've had a bit more success after deploying the 7.01 version of the EmailReceiver QPAC that comes with the 7.0.2 version of the SDK. I can now load a received PDF into a document variable, however attempting to use that as the input to a User task generates all kinds of errors. I verfiied that the PDF is OK by using Avoka's Document Export QPAC.



In trying what I really want to do, which is load a XDP received via email back into a form variable, I'm getting the following error....



Invoked onMessage for component: NewEmailReceiver with ai: 666 and msg-id: qpac-polling-retry

Found attachment:Exercise1 (5)_data.xdp

java.lang.RuntimeException: Start cannot be greater than end

at com.adobe.workflow.tools.qde.utils.XpathExpressionParser.getSubExpression(XpathExpressionParser.java:102)

at com.adobe.workflow.tools.qde.utils.VariableExpressionParser.getSubExpression(VariableExpressionParser.java:68)

at com.adobe.workflow.tools.qde.utils.Expression

Wrapper.hasSubExpression(ExpressionWrapper.java:163)

at com.adobe.workflow.tools.qde.utils.Expression

Wrapper.setProcessDataBinaryValue(ExpressionWrapper.java:213)

at com.adobe.workflow.qpac.emailreceiver.EmailRe

ceiverService.processEmail(EmailReceiverService.java:271)

at com.adobe.workflow.qpac.emailreceiver.EmailReceiverService.runTask(EmailReceiverService.java:100)



Any clues ?

Avatar

Level 9
Hi Rob



What is the xpath expression you're using to specify the location you'd like to store your attachment into?



Howard

http://www.avoka.com

Avatar

Former Community Member
I have created a process form type variable called 'formVar' and have used the xpath /process_data/formVar. I have tried various derivations of this as well /process_data/formVar/form-data, /process_data/formVar/form-data/data, etc. without success.



Also.. an interesting note... I was able to load the received XDP into a process xml type variable BUT first I had to make sure that in Forms Designer I set the encoding attribute on the Submit button to UTF-8 first (the default is UTF-16).

Avatar

Level 9
Hi Rob



We've reproduced your problem, and we're working on a fix. Please send me an email to htreisman at avoka.com, and I'll organize a patch for you.



Howard

Avatar

Former Community Member
Hi Rob,



have you gotten your workflow to work? I'm quite desperately trying to set up the email receiver QPAC, which is the start action of my workflow. But it stalls all the time, even if in its 'retry'-tab I use 'continue with error'.

I'm trying to use a varibale of type form, to store the email's attachment. Do I have to include anything special in the form for the QPAC to work? Does the emails have to encoded in a special way?



Steve

Avatar

Level 9
Hi

Please make sure you're using the latest email receiver from Workflow SDK 7.0.2. If you're still having problems, please repost!



Howard

http://www.avoka.com

Avatar

Level 9
Please also post the stack trace of the stall message. This will enable us to work out what's actually going wrong.



Howard

Avatar

Former Community Member
Sorry for having confused you. Though the process stalls, actually there's no 'stall'-message. In Livecycle admin ui, the process manager indicates that the process is still running (and it continous to do so forever until I manually stop it). The workflow doesn't continue with the next component, it runs the email receiver component forever.



In Workflow Designer in the email receiver QPAC in the 'retry'-tab I'm using 10 retries, every 5 seconds and 'continue with error'. The QPAC's version reads 7.01. Still, process explorer indicates process instances running after half an hour with the process type still reading 'email receiver'.

Avatar

Level 9
Hi

Are you sure that the QPAC hasn't stalled? It may still show up as "Running" in the process search results screen. You need to look at the Stalled Actions screen to see whether it's actually stalled.



If it's really still running, it means that it hasn't found a matching email. Have you specified parameters for subject, sent-by, or other parameters? Are you sure that the email is actually sitting in the designated inbox.



I'll work on a sample, and post it as soon as I can.



Regards,

Howard

Avatar

Level 9
Hi



I've built a small sample for the EmailReceiver QPAC.

It consists of a form whose data you can submit as an attachment to an email to a POP account. A workflow then pulls the data from the email, and populates a form variable. It then assigns the form to a user for review.



You can download the workflow, the form and an updated version of the EmailReceiver QPAC from:

http://www.avoka.com/samples/EmailReceiver



You will need to make some minor modifications to the form and the workflow to point it at your own custom email account. I suggest you experiment with a test email account if possible, just in case.



Regards,

Howard