cancel
Showing results for 
Search instead for 
Did you mean: 

How to createAttachment inside Java Service Task

mcormaechea
Champ in-the-making
Champ in-the-making
Hi, I am trying to createAttachament to a process, inside a JavaServiceTask.  My class implements JavaDelegate. I need to pass DB taskid to the method createAttachment, but I dont know where to get this value from:

   taskService.createAttachment("application/pdf",
               TASKID, execution.getProcessInstanceId(), "Carta de Admisión",
               "Carta que admite al postulante como Estudiante Regular Internacinal", pdfStream);

DelegateExecution has a method getCurrentActivitiId() but that's not DB id .

Do you have any ideas??

Thank you very much!!!

Celeste.-
2 REPLIES 2

mcormaechea
Champ in-the-making
Champ in-the-making
Hi tried sending null as taskId but I cannot see the attachment in activiti tables. I dont even get any exceptions.

I seem to be very late answering this but this works for me:

String ActivitiPID = processInstance.getId();