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

**URL:** <https://forum.flowable.org/t/recommended-approach-to-check-if-user-has-active-task-from-custom-front-end/2584>\
**Category:** Flowable Engine\
**Created:** [September 17, 2018, 2:50pm UTC](https://forum.flowable.org/t/recommended-approach-to-check-if-user-has-active-task-from-custom-front-end/2584 "2018-09-17T14:50:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![farrukh](https://avatars.discourse-cdn.com/v4/letter/f/779978/32.png) [@farrukh](https://forum.flowable.org/u/farrukh)\
**Post date:** [September 17, 2018, 2:50pm UTC](https://forum.flowable.org/t/recommended-approach-to-check-if-user-has-active-task-from-custom-front-end/2584/1 "2018-09-17T14:50:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![filiphr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/filiphr/32/315_2.png) [@filiphr](https://forum.flowable.org/u/filiphr)\
**Post date:** [September 17, 2018, 3:46pm UTC](https://forum.flowable.org/t/recommended-approach-to-check-if-user-has-active-task-from-custom-front-end/2584/2 "2018-09-17T15:46:51Z")

</div>

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

```auto
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

---

<div class="post-metadata">

**Author:** ![farrukh](https://avatars.discourse-cdn.com/v4/letter/f/779978/32.png) [@farrukh](https://forum.flowable.org/u/farrukh)\
**Post date:** [September 17, 2018, 7:18pm UTC](https://forum.flowable.org/t/recommended-approach-to-check-if-user-has-active-task-from-custom-front-end/2584/3 "2018-09-17T19:18:01Z")

</div>

Thanks filiphr for providing quick response to our query.
