Passing localVariable of type File to its parent Process with inputOutput loses filename and mimeType

Hey there,

when using the API to upload a file as localVariable with filename and mimeType, I can retrieve the metadata from the API and everything is as expected.

But when mapping this localVariable to the parent (Sub) - Process with inputOuput parameter, it is saved as type: byte and the metadata are lost even though (the byte values still contain the uploaded File)

mapping:
image

Is there anyway i can keep the meta-informations?


Expected behaviour would be to see Type: File

I had a similar problem while passing a file variable using message which I solved using JavaDelagte. One has to explicitly send a typed variable in such cases.

exeuction.setVariable("fileVar", (FileValue) execution.getVariableTyped("fileVar"))

This ensures metadata transfer as well.
For sub-process input output mapping, JavaDelegate does not seem to be available. But my hunch is that same can be achieved using type script instead of text and then sending a typed file variable explicitly. I am not sure whether JavaScript or Groovy API supports all functions in RuntimeService or DelegateExecution interface.

Hope this helps.

Chaitanya

Hello
Can you share your solution in a working bpmn file with a JavaDelegate? I have to pass a file variable with a message to a new process I’m starting with this message.
${execution.getProcessEngineServices().getRuntimeService().createMessageCorrelation(“message_test”).processInstanceBusinessKey(“AB-123”).setVariable(“clientName”,clientName).correlateWithResult()} converts file to byte

This is an example for a Message throw event:
${execution.getProcessEngineServices().getRuntimeService().createMessageCorrelation("message_test").processInstanceBusinessKey("desiredBusinessKeyFroNewProcessInstance").setVariable("variable1ofprimitiveType",variable1ofprimitiveType).setVariable("variable2ofTypeFile", execution.getVariableTyped("variable2ofTypeFile")).correlateWithResult()}

This should work in listeners and input|output mapping (script)

setVariable("variable2ofTypeFile", execution.getVariableTyped("variable2ofTypeFile"))