I have a case of two tasks being executed in parallel. One sends an email notification to reviewer, another one is an actual reviewer UserTask. I want to pass in email a taskId (to have a link to a Task list web app in email). However, when I run def taskId = execution.getProcessEngineServices().getTaskService().createTaskQuery().processInstanceId(execution.getProcessInstanceId()).list()
in step 020 in input parameters - I get nothing. So, apparently, Task 010 was not yet created. Both 010 and 020 are set asynchronous after / exclusive
What would be a proper way to ensure that another task in a parallel flow already exists to retrieve its id?
That isn’t the best approach, you should instead use a task listener on the user task which runs once the task has been assigned that way you’d have access to the task ID and it was also work incases where the task is reassigned. It would look something like this:
Hope both you and your hawk are doing well. Thank you for your suggestion. I am quite keen to keep “low-code” approach, so the proposed solution is not in line with our architecture. At the moment adding a timer before Notify event works for me. However, I’m looking for a more robust way to synchronise / correlate activities here using signals/messages probably?
Thanks for asking - my hawk often feels like he deserves more attention on the forum, he’ll be happy to her someone was asking about him
I don’t think adding a timer is a very good idea though - a much better solution would be to add a transaction boundary before your notify task - you can do that as follows:
EDIT: Please ignore the fact i closed the gateway incorrectly.