Hello world!
I am new to Camunda !
I am trying to create a user task variable that will enable the user to download a zip file.
I’ve created a service task to problematically fetch the file and attach it to the process as a variable process.
Below the piece of code I am using :
Then, I am calling the process variable downloadZipVariable in a form in this way :
<a cam-file-download=downloadZipVariable></a>
When I’ve tested the code below with a zip file of 4xx Ko, the code works perfectly.
However, when I used a zip file of 70Mo, Camunda craches I get this error :
It’s likely that the Camunda transaction times out. In general, process variables are not suited to store large files and you are going to observe rather bad performance down the road. I recommend to store such data in a separate storage and only reference it from your process instance.
Hi Thorben,
Thank you for your prompt reply.
I come to the following external storage solution :
I’ve created a public directory in Apache web server where I store the myFile.zip and reference the file location in camunda process variable.
I’ve created a user form which contains a download link. The link uses the file location stored in camunda process variable.
Here is the piece of code I am using for the user form :
<br /> <a download> Click here to download content </a>
<script cam-script type="text/form-script">
var variableManager = camForm.variableManager;
camForm.on('form-loaded', function() {
// this callback is executed *before* the variables are loaded from the server.
// if we declare a variable here, its value will be fetched as well
variableManager.fetchVariable('downloadZipVariablePath');
});
camForm.on('variables-fetched', function() {
// value has been fetched from the backend
var value = variableManager.variableValue('downloadZipVariablePath');
// write the variable value to the form field
console.log(value);
$("a").attr("href", value)
});
</script>
I am currently working on finding a workaround to do the opposite operation : uploading large file in a user form without loading it as a process variable. Work in progress…
Best regards,
Hanane