Dynamic Completion of Task using JSF

Hii everyone,
I am Having a BPMNSampleBPMN.bpmn (3.3 KB)

I am Using JSF for User task and all the task completion are done using the Java API from the managed bean(Not using external task form or any types of forms since it callback to the tasklist). So i have a challenge to make the process completion Dynamic.My situation is :
1)when the process instance comes to the first user task(User task 1) i have to check whether there are any user tasks followed.

  1. So there is a user task after a service task.Then i have to complete the user task and then wait for the service task to get completed and then have to execute the User task 2

  2. Then when i finish the user task 2 there is no user task after it so i just have to complete the user task 2 and dont need to wait

So is it possible to check if there is any User task followed by the current user task

Thanks,
Jayapragadeesh

Looking at the documentation on JSF Task Forms, I’m seeing a clear pattern of leveraging startTaskForm and completeTask, nothing in regards to having to wait or look ahead. How is your use case different? Just trying to understand what you’re attempting :slight_smile:

hi @jgigliotti,
Thanks for the response.

So in the documentation to complete a task we have a button

<h:commandButton id="complete" value="Task Completed"
          action="#{camundaTaskForm.completeTask()}" />

So when this button is clicked the User task is completed, and it returns back to the TaskList. So in my Use case i want to go to the next User task. Based on the Documentation i couldnt find anything regarding moving to the next User task.
So i am trying to use the Java API to complete a task and fetch the next form key through my managed bean.

I would probably recommend letting your process drive that behavior. Let the token move along after completing the form and if the next task is a user task, then the cadence repeats itself with another startTaskForm method.

So in my Use case i want to go to the next User task

It sounds like you’re forcing the user to claim the next task and start the work. This is also something you probably don’t want to do. It’ll be awkward for your user and as time goes on, probably a fair amount of overhead to maintain. If you require more data from that same user, then it sounds like a multi-form task would be more appropriate. From the documentation I linked to above,

Note that the command button doesn’t have to be on the same form, you might have a whole wizard containing multiple forms in a row before having the completeTask button. This will work because of the conversation running in the background.