


Views
Replies
Total Likes
Hello,
Anybody knows how to do it?
My requirement is:
A user attaches some image files in the workspace while filling the form. I need to attach these image files when i'm emailing the filled pdf form as an attachment to a user.
How can i do that? Is it possible?
Thanks in advance
Deepak
Views
Replies
Sign in to like this content
Total Likes
Yes it is possible. You would have to get the images out of the task (in the user task, under Attachments and Notes, there is an Output Attachments area that needs a list of documents to hold the inbound attachments). Now that you have the attachments in a list var you can use the Forms RenderPDF service to Render the PDF and add the attachments to the PDF. Note that the RenderpDF service expects the attachments in a map and not a list so you will have to change it from one to the other.
Paul
Views
Replies
Total Likes
Hello pgurett,
Thanks for your valuable comments. But still the functionality is not working.
Let me explaing the steps i followed:
1. Created 2 process variables
OtherAttachmentsList - Type list - subtype Document
OtherAttachmentsMap - Type map - subtype Document
2. On the Assign task, under Attachments and Notes, I have set the output attachment variable to OtherAttachmentList
3. Before renderPDF, on the Setvalue control i have assigned OtherAttachmentsMap = OtherAttachmentsList.
You have told to convert from list to map. How i have to do? I'm simply assigning as above.
4. On the RenderPDF form control, under attachments, i have set the variable as OtherAttachmentsMap
Now the process is getting stalled at the RenderPDF form step and the exception it is giving is:
java.lang.ClassCastException: java.lang.Integer
at com.adobe.formServer.docservice.FormsDocService.appendAttachmentsToInputData(FormsDocService.java:724)
at com.adobe.formServer.docservice.FormsDocService.renderPDFForm(FormsDocService.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.adobe.idp.dsc.component.impl.DefaultPOJOInvokerImpl.invoke(DefaultPOJOInvokerImpl.java:181)
at com.adobe.idp.dsc.interceptor.impl.InvocationInterceptor.intercept(InvocationInterceptor.java:134)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:44)
at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor$1.doInTransaction(TransactionInterceptor.java:74)
at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionBMTAdapterBean.doRequiresNew(EjbTransactionBMTAdapterBean.java:218)
at sun.reflect.GeneratedMethodAccessor334.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)
at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:54)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:158)
at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:62)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:154)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
at org.jboss.ejb.Container.invoke(Container.java:873)
at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:415)
at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:88)
at $Proxy164.doRequiresNew(Unknown Source)
at com.adobe.idp.dsc.transaction.impl.ejb.EjbTransactionProvider.execute(EjbTransactionProvider.java:133)
at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor.intercept(TransactionInterceptor.java:72)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:44)
at com.adobe.idp.dsc.interceptor.impl.InvalidStateInterceptor.intercept(InvalidStateInterceptor.java:37)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:44)
at com.adobe.idp.dsc.interceptor.impl.AuthorizationInterceptor.intercept(AuthorizationInterceptor.java:80)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:44)
at com.adobe.idp.dsc.engine.impl.ServiceEngineImpl.invoke(ServiceEngineImpl.java:113)
at com.adobe.idp.dsc.routing.Router.routeRequest(Router.java:102)
at com.adobe.idp.dsc.provider.impl.base.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:88)
at com.adobe.idp.dsc.provider.impl.vm.VMMessageDispatcher.doSend(VMMessageDispatcher.java:210)
at com.adobe.idp.dsc.provider.impl.base.AbstractMessageDispatcher.send(AbstractMessageDispatcher.java:57)
at com.adobe.idp.dsc.clientsdk.ServiceClient.invoke(ServiceClient.java:208)
at com.adobe.workflow.engine.PEUtil.invokeAction(PEUtil.java:553)
at com.adobe.workflow.engine.ProcessEngineBMTBean.continueBranchAtAction(ProcessEngineBMTBean.java:2863)
at com.adobe.workflow.engine.ProcessEngineBMTBean.asyncContinueBranchCommand(ProcessEngineBMTBean.java:2392)
at sun.reflect.GeneratedMethodAccessor935.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)
at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:54)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:158)
at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:62)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:154)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
at org.jboss.ejb.Container.invoke(Container.java:873)
at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:415)
at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:88)
at $Proxy196.asyncContinueBranchCommand(Unknown Source)
at com.adobe.workflow.engine.ProcessCommandControllerBean.doOnMessage(ProcessCommandControllerBean.java:133)
at com.adobe.workflow.engine.ProcessCommandControllerBean.onMessage(ProcessCommandControllerBean.java:94)
at sun.reflect.GeneratedMethodAccessor759.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:475)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)
at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:101)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:94)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:389)
at org.jboss.ejb.Container.invoke(Container.java:873)
at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:1077)
at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1379)
at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)
at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:904)
at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:160)
at org.jboss.mq.SpySession.run(SpySession.java:333)
at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
at java.lang.Thread.run(Thread.java:595)\
What could be the problem?
Thanks
Deepak
Views
Replies
Sign in to like this content
Total Likes
You cannot simply assign a list var to a map var. You will have to iterate through each item in the list and assign it to the map var.
Views
Replies
Total Likes
Hello pguerett,
Right now I have implemented it for one attachment.
Let me explaing the steps i followed:
1. Created 2 process variables
OtherAttachmentsList - Type list - subtype Document
OtherAttachmentsMap - Type map - subtype Document
2. On the Assign task, under Attachments and Notes, I have set the output attachment variable to OtherAttachmentList
3. Before renderPDF, on the Setvalue control i have assigned OtherAttachmentsMap = OtherAttachmentsList.
I have done as you have instructed. (using docAttach, getting filename ...)
4. On the SendWithMapofDocuments control, under attachments, i have set the attachment variable as OtherAttachmentsMap
i'm doing like this:
/process_data/@docAttach = /process_data/list[1] --------------- docAttach is a varibale of type document
/process_data/@docName = getDocAttribute(/process_data/@docAttach, "wsfilename") -------- docName is of type string
/process_data/@docDesc = getDocAttribute(/process_data/@docAttach, "wsdescription") --- docDesc is of type string
********Assign it to Map:************
/process_data/mapDoc[@id=/process_data/@docName] = /process_data/@docAttach --- mapDoc is a map subtype document
Now my problem is, I'm getting attachment on the email but the content is not proper. Can there be any problem with the mime type or the encoding standards? Or am i missing any configurations?
I even tried with the loop also... it is working fine but the problem is none of the files would be in proper format. filename, extention, everything will be similar to the docs that i attach but when tried to open it is failing. Please guide me, where is it getting...
Deepak
Views
Replies
Sign in to like this content
Total Likes
Hi..
Got it!!!
While testing something i had changed subtype of map to string later i forgot to change back to document...
Deepak
Views
Replies
Sign in to like this content
Total Likes
In the document variables there are attributes that can be set for mimetype etc. .....If you do a record/playback and look at the document you can get the attribute value that needs to be set.
Paul
Views
Replies
Total Likes
Hi..
I have got my issue resolved....
Thanks for all the members for their valuable suggetions...
Deepak
Views
Replies
Sign in to like this content
Total Likes
Hi
Im facing the same issue. It would be nice if you provide the code for looping through the attachments and assigning from List to Map variable.
Thanks,
Balaji
Views
Replies
Sign in to like this content
Total Likes
hi all.
I have tried more than a couple of times the below, i could execute the code with no error but unable to see any attachments ..
Can u pls go thru and update ..
//import the classes that the script references
import java.util.List;
import java.lang.String;
import java.util.Map;
import java.util.HashMap;
import java.io.*;
import java.lang.*;
import java.util.*;
import com.sun.xml.internal.txw2.Document;
try
{
List attachmentListDoc = patExecContext.getProcessDataListValue("/process_data/inputattachments");
Map attachmentMapDoc = new HashMap();
for (int i = 0; i < attachmentListDoc.size(); i++)
{
//String currentFileName = (String)attachmentListDoc.get(i);
Document doc = (Document)attachmentMapDoc.get(i);
attachmentMapDoc.put(i, doc);
//attachmentMapDoc.put(i, attachmentListDoc.get(i));
}
patExecContext.setProcessDataMapValue("/process_data/attachmentsmap",attachmentMapDoc);
}
catch (Exception e)
{
e.printStackTrace();
}
thanx
Balaji
Views
Replies
Sign in to like this content
Total Likes
What do you get for attachmentMapDoc.size()?
Does it populate the map properly?
Jasmin
Views
Replies
Sign in to like this content
Total Likes
there's a mistake in the line
patExecContext.setProcessDataMapValue("/process_data/attachmentsmap",attachment MapDoc);
}
You have a space in the name of the map variable.
Just out of curiousity, where does e.printStackTrace() get displayed? It might be more useful to, in your catch, save the stack trace to a string variable.
Execute Script is very useful, but also very difficult to debug.
scott
Views
Replies
Sign in to like this content
Total Likes
No the above code did not work out ..
I made it work using Iterator - very small code below .. jus for ur reference
import java.util.List;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;
import com.adobe.idp.Document;
List attachmentListDoc = patExecContext.getProcessDataListValue("/process_data/inputattachments");
Map attachmentMapDoc = new HashMap();
Iterator it = attachmentListDoc.iterator();
while (it.hasNext()) {
Document attDoc = (Document) it.next();
String name = (String) attDoc.getAttribute("wsfilename");
attachmentMapDoc.put(name,attDoc);
}
patExecContext.setProcessDataMapValue("/process_data/attachmentsmap",attachmentMapDoc);
This converts List to Map successfully. This code helps whoever is in need of.
thanx
Balaji
Views
Replies
Sign in to like this content
Total Likes
Kindly mark the discussion as Answered.
Regards,
Waqas
Views
Replies
Sign in to like this content
Total Likes
how can i do that, i'm not finiding any way to that...!!
Views
Replies
Sign in to like this content
Total Likes
Hi
A simpler way to convert a list to a map, or a map to a list, and various other operations, is to use our CollectionUtils component.
Here: http://avoka.dnsalias.com/confluence/display/Public/Collection+Utilities+DSC
Download here: http://www.avoka.com/avoka/escomponents.shtml
Howard
Views
Replies
Sign in to like this content
Total Likes