cancel
Showing results for 
Search instead for 
Did you mean: 

Skip doesn't work when user task assigned to group

dan1
Champ in-the-making
Champ in-the-making
Running 5.21 with postgresql DB.

I have a very simple process with 2 steps. First is a groovy script to enable skip by setting _ACTIVITI_SKIP_EXPRESSION_ENABLED to true. Second is a user task with a skip expression. The start form prompts whether or to skip the user task.

If the user task is assigned to a person (i.e. initiator) and the initiator elects to skip the user task, all works well. See snippet below. The complete process is in the Skip_Initiator_Task.bpmn_.txt attachment.

    <userTask id="userTask1" name="User Task 1" activiti:assignee="${initiator}" activiti:skipExpression="${skipUserTask1 == true}"></userTask>

If the user task is assigned to a group (e.g. engineering) and the initiator elects to skip the user task, the process fails and we get a traceback. See snippet below. The complete process is in the Skip_Group_Task.bpmn_.txt attachment. See tracebacks in tracebacks.txt attachment.

    <userTask id="userTask1" name="User Task 1" activiti:candidateGroups="engineering" activiti:skipExpression="${skipUserTask1 == true}"></userTask>

Is this a known issue? I know that I could work around this using gateways. However, I would really like to leverage skip for my purpose.

Thanks,
Dan
1 REPLY 1

dan1
Champ in-the-making
Champ in-the-making
Finally got back around to looking at this. I was able to work around the issue I was having. This thread is related to the issue:

https://forums.activiti.org/content/completing-task-within-createlistener

lmazurk's post is similar to how I worked around my issue. I'm using a TASK_CREATED event listener which assigns and completes the task if the skip expression evaluates to true. In order for this to work, _ACTIVITI_SKIP_EXPRESSION_ENABLED must be false. And you can't invoke taskService.complete within the existing transaction or you get the traceback I attached to original post. Instead the code creates a timer task that actually invokes taskService.complete. This gives the engine a chance to complete the transaction.

Unfortunately, this is a bit hacky and requires use of internal code.