I did as stated in documentation but I get an exception :
"Declared return type interface org.bonitasoft.engine.bpm.document.Document is not compatible with evaluated type class org.bonitasoft.engine.bpm.document.DocumentValue for expression docEntree"
Finally, I moved my code to a groovy scripting connector and it's working now.
Previously I had a task with no connectors at all and the code in an document assignment operation.
I think there may be a bug in case of a task having operations only (no connectors).
I think some bug may still be around with v2022.1. I've just hit the same thing with a process step that I have *not* changed for over a week, which was working up until today.
Trying to work out what triggered it, no luck so far. Why is Bonita suddenly telling me I've declared the return type to be Document when I've clearly set it to DocumentValue?
2022-07-12T11:45:25,431+1200 | bonita-test | WARN | [Bonita-Worker-1-09|658] o.b.e.w.RetryingWorkExecutorService - THREAD_ID=658 | HOSTNAME=bonita-test | TENANT_ID=1 | Work ExecuteFlowNodeWork: flowNodeInstanceId: 365934 (37, false, false, false) failed. The element will be marked as failed. Exception is: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: FLOW_NODE_INSTANCE_ID=365934 | Declared return type interface org.bonitasoft.engine.bpm.document.Document is not compatible with evaluated type class org.bonitasoft.engine.bpm.document.DocumentValue for expression docWorkOrderMR
wrapped by org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: FLOW_NODE_INSTANCE_ID=365934 | Declared return type interface org.bonitasoft.engine.bpm.document.Document is not compatible with evaluated type class org.bonitasoft.engine.bpm.document.DocumentValue for expression docWorkOrderMR
Thanks, I'll try to get to making something reproducible in the next week or two, as I'm swamped with testing and training on this project, and for now have my workaround. Still don't know why the behavior changed a couple of weeks after I wrote this bit, but my guess is that it may be difficult to reproduce.
Bonitasoft empowers development teams with Bonita, the open-source and extensible platform to solve the most demanding process automation use cases. The Bonita platform accelerates delivery of complex applications with clear separation between capabilities for visual programming and for coding. Bonita integrates with existing solutions, orchestrates heterogeneous systems, and provides deep visibility into processes across the organization.