Files out of parallel multi-instance forms

Dear Community,

I am new to Camunda and I am using the Camunda Run to avoid developing in Java. I have a parallel-multi-instance form requiring different players to upload each of them a file.

I would like a follow-on task to generate a report out of the different files uploaded, and therefore, I need to get the File variables resulting out of the multi-instance forms. To do so, following some indications I’ve seen from @Niall and @StephenOTT I created a “collector” variable on start using the following script:

texttask.execution.setVariable(‘signatures’, {value: [], type: “json”, valueInfo:{})`;

My form stores the file in a variable “signedPage” following the example of the documentation:

<input type="file" width="100" cam-variable-name= "signedPage" cam-variable-type="File" cam-max-filesize="10000000" id="signedPage" name="signedPage" />

And then I add an javascript event listener on completion of each of the instances of my parallel-multi-instance form like follows:

var jsonSignatures = JSON.parse(task.execution.getVariable('signatures'));
var Sign = task.execution.getVariable('signedPage');

My understanding is that the engine creates a variable type “File” when clicking submission, and that variable, implicitly, is a JSON I can get , including the name of the file and a link to the blob in the database where the file is stored.

When inspecting signatures property “value”, what I get is a sequence of “null”, one per form, as follows:

{"value":[null, null, null, null],"type":"json","valueInfo":{}}

On my listener script I tried to change the 2nd like to

var Sign = JSON.parse(task.execution.getVariable('signedPage'));

but then I get an exception sating that variable ‘signedPage’ is a array.

How can I get the “File” objects out of my listener?

Thanks in advance

Hello Community. Just popping out to see if anyone has wondered a solution.

I also have discovered a new twist. It seems the link to download the files is always the same, so I can only get the latest file submitted. Does this mean that I would have to download the file to disk, having it outside the transaction?

Thanks again.