Recommended approach to check if user has active task from Custom Front End

Hi,

We will be using Flowable embeded as spring boot dependencies and exposing our own APIs to create process and complete tasks which will be used by our custom front end for execution of workflow.

We want to know what is the recommended way to let front end know if any user task for current user is being created and active. We want this information in order to display users next task screen or display that task is completed.

Consider following use cases:

  1. Process Start - > User Task 1 (Current user) -> Http Task -> User Task 2 (Current user) -> Process End
    In this case User will have task assigned to him but followed by Http Task which may take time.

  2. Process Start -> User Task 1 (Current user) -> Http Task -> Service Task -> Process End
    In this case process will have subsequent tasks after User Task 1 but none will be assigned to user.

We are thinking of Pooling for checking if started process has active task assigned to current user or current process is completed.

@farrukh if you use the Java API to start the processes you can do something like.

ProcessInstance instance = runtimeService.startProcessInstanceXXX(...);

taskService.createTaskQuery()
    .active()
    .taskAssignee(currentUserId)
    .processInstanceId(instance.getId())
    .list();

This query will return you all the tasks assigned to the current user for the last process instance.

Pooling is also an option, it all depends on what you are really trying to achieve. If you want to give the next tasks in the current request you should do something like I wrote, otherwise you can just pool and get all tasks for the current user.

Cheers,
Filip

Thanks filiphr for providing quick response to our query.