Attachment not found in Camunda for a create listener following a start event

Hello,

For the following Bpmn diagram, I have attachments for at the start event and a create listener in the Validate task. In this listener I try to get the attachments of the start event. But I didn’t get any thing, But for the Execute task, I always got these them.

Please what is wrong for my approach?

This is how, I do (in groovy):

Start process instance and attachments :
def processInstance = runtimeService.startProcessInstanceByKey(processDefinitionfKey, variables) attachementList.each { attachment -> taskService?.createAttachment(attachment.contentType, null, processInstance.id, attachment.name, '', attachment.document) }

// Try to get the attachments in the create listener for Validate task

try {
def attachements = delegateTask.getProcessEngineServices().taskService.getProcessInstanceAttachments( delegateTask.processInstanceId)
}catch(e){
println("Get attachement error: ${e.message}")
}

The variable attachments is always empty for me in Validate task but not in the Execute task.
Thank you.

1 Like