Hi,
We have the following requirement: In a User Task, a new document needs to be created, and right after its creation, we want to set multiple fields.
In theory, we wanted to do this using the setDocumentFieldDelegate, but in practice, we encountered the following issues:
- With setDocumentFieldDelegate, only one field can be set per task.
- The TaskCreateListener, which creates the document, is processed in the lifecycle after the ExecutionListener.
Look https://stackoverflow.com/a/29508312
Do you have any idea how we can solve this?
Hi @steve-tagged-cache ,
There aren’t any easy tricks that you can use based on the delegates provided in the 2023.06 release line.
From a modeling point of view, it sounds like you need a Service Task that creates the document and sets the Field Values. Alternatively, two Services Tasks to create and then modify the Document.
In the 2024.06, the ${createDocumentDelegate} was added which allows you to create an empty document with a Service Task. You would then need to manually edit this document before moving to a User Task that takes an existing Document.
start event → service task create → service task modify → user task
That being said, there is no delegate that allows large scale changes to be made to a Document in either 2023.06 or 2024.06. This Delegate Expression would need to be custom.
Dear @steve-tagged-cache ,
was the response helpful and is the issue now solved or are there some additional questions? If it is solved, please, use the checkbox to mark the solution to your problem so that other users also know what helped to your case.
all the best from the Discourse team
Hello svweber,
thank you for the reminder. The implementation is as follows:
We created a pseudo user task responsible for generating the document. An associated AutoCompleteTaskListener ensures that the task is automatically completed without any user interaction. Afterwards, the document is initially populated with the required data.
Greetings