This is json code for the form of upload file

       "name":"Upload source project (project folder or zip file)",

And in a method inside a execution listener class I created I have this code

 taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); 
    Attachment attach = taskService.getAttachment("upload_file");
   System.out.println("Attachment not null");
    } else {
        System.out.println("Null file attached");

Every time I get a null file.

I am not able to retrieve the file uploaded. I don't know what I am doing wrong Can you please help me how get the attachment?

  • try - getTaskAttachments(String taskId) method from TaskService to get All Attachments of a task. – Abbas Kararawala Apr 26 '17 at 7:36

Please try this code may help you for getting the attachment ids.

ActivitiScriptNode scriptNode = (ActivitiScriptNode)execution.getVariable(WorkflowNotificationUtils.PROP_PACKAGE);              
NodeRef packagenode = scriptNode.getNodeRef();
NodeRef docRef= Configuration.serviceRegistry.getNodeService().getChildAssocs(packagenode).get(0).getChildRef();
  • Thank you. But I need little more help. Like, how to get attachment id. String attachment_id = ......//how to get it here – Kangkan Apr 28 '17 at 6:16

Your Answer

