Has anyone succeeded in accessing a process variable of type=file on an external form. I’m trying to access it as you would a normal variable (which I succeed with) but cannot get it to work for files.
I use Java / Thymeleaf to access the variables. Here are my code snippets:
private void populateForm(Model model, ExecutionEntity existingProcess) {
Map<String, Object> variables = runtimeService.getVariables(existingProcess.getProcessInstanceId());
model.addAttribute(“processInstanceId”, existingProcess.getProcessInstanceId());
model.addAttribute(“vOrderNumber”, variables.get(“vOrderNumber”));
model.addAttribute(“vFileOrder”, variables.get(“vFileOrder”));
Then in the form:
<p>Order Confirmation : [[${vOrderNumber}]]</p> <p>Order File : [[${vFileOrder}]]</p>
In the above form, the order number resolves correctly
but the order file returns : java.io.ByteArrayInputStream@73a539f3
I have also tried the following java:
FileValue retrievedTypedFileValue = runtimeService.getVariableTyped(existingProcess.getProcessInstanceId(), “vFileOrder”);
String fileName = retrievedTypedFileValue.getFilename();
model.addAttribute(“vFileOrderName”, fileName);
InputStream fileContent = retrievedTypedFileValue.getValue();
model.addAttribute(“vFileOrderContent”, fileContent);
I’m not at all proficient in Java and it takes me many hours to figure out how to achieve something - so please bear with me.