Configuring User task based on parameter from Task

We are working on POC to find Flowable suite one of our customer’s requirement. We have a requirement which states that based on the parameter’s value in Task the user / user group should get selected and the Task should go the corresponding user.

Ex. In the sample HR workflow that is given in your documentation, If John applies for leave it goes to the person which is given in the user task during the design time. Is it possible the if I enter John then the approval should go to his supervisor Peter and if I enter William the approval should go to Steve.

Also can this be automatically integrated with my company’s organization chart, so that when there is change we change it at one place.

As this a very common scenario is there any best practice that can be implemented and sample that is already working?

The easiest way is to have a service that returns a given user’s manager/approver and use this as the assignee (by using a variable for the assignee rather than an explicit user). This could be a Java Service Task or an HTTP Service Task. If you want something more “built-in”, so not a step in the process, you could create an event listener for this type of approval task that does the lookup whenever an instance of this type of task is created by a process.

May be others have suggestions too!


How to configure Assignee of User Task Based on parameter from previous step. we are not able add expression in Assignee property, there is no such option available.

Hi Paul, Thanks for your quick response, We did try to use Assignee route, but not able to find way to assign variable to user. Can you help us in getting this understanding.


Hi Subbu,

The easiest way to see it is with the UI apps to create a simple process with a start form containing a Person field, then create a User Task with the assignee set to the static value of the variable. You’ll need to have another user defined in the system to see it. You can do the same with a process variable from a Service Task rather than a form.






1 Like

If you use a directory server (e.g., AD, OpenLDAP, ApacheDS) then you can query it for information about a user’s manager.


Thanks a lot Paul, we are able to get the assignee with expression, however two more question as below

  1. how to create a process and complete the same task with single api call . From your documentation we are able to create process then we have to query the task id and then we are able to complete the task, is there any way to complete the same process in a single api call

  2. how to get pending task with all data (all variables) filled by user, currently with the help of your api we are able to get the pending task for the user but no data coming which was filled by the user. to get that we have to find out the task id and then query for the variable, is there any way to get the all tasks with variables in a single api call.

It would help if you could give a bit more information around how you’re using the engine, more background of the use case, so we have a bit more context. There isn’t a single API to start a process and complete a task, as a process may have any number of different tasks, and having a task that completes immediately isn’t a normal use case.

When you say data filled by the user, are you using the forms engine, or form properties, or some other approach?


Thanks again Paul for your quick response, As mentioned earlier we are doing a POC to select workflow tool for one of our customer. The use case is simple, they want to use Flowable hooked through api.
Ex An Employee submitted his leave request it should go his supervisor for approval. So Submit is one button click and after that action the leave request should go the supervisor.
So if we use Flowable we need to do as below:

  1. Call the api for creating the leave request
  2. Call the api to get the task id just created
  3. Call the api and write a custom code to pass the task id and action as complete
    After these 3 steps only the supervisor will get the leave request for his approval.
    The question is the only way to do this or can we sum up all the 3 steps and avoid step 2 and custom code.

On the 2nd Question
We want to show all the task for the supervisor in the above example.

  1. Call api to get the task list
  2. Call api and pass the task id for each task and get the all the variable details.
    Variables I mean the Number of Leave applied for, From Date, To date, etc…

The way you might usually do this is with a Start Task form. Are you using an external forms engine, or your own forms UI?

If you use the forms builtin to the Modeler and Task apps, then you can attach a form to the Start event. When you go to start the process it will have that start form ready to fill in before the process instance is actually completed.

If you’re doing it purely via API, you would create a custom form in your UI and get all the necessary data - then pass this data as input variables when starting the process. That way you don’t need a User Task as the first step to collect inital information. If you’re using the REST API:


Thanks a lot Paul, Yes we want to use it through api only don’t want to use Flowable form.
Also can you respond on my second question on getting all the task details through single api call? or we should do 2 api calls?


Thank you very much for such a wonderful support by you. with your help we were able to successfully complete one scenario and now we are working on second scenario, the requirement is as followsscenario

Case 1. Group A should have manual override option. If Group A approves before Group B of and decides to override BH’s approval then Task will directly go to Head. If Group A approves before group B and does not override BH’s approval then Task will go to BH then Head

Case 2: if Group B approves before Group A then task will directly go to Head.

Question: 1. how to get which group claimed the task, and depending on group can we give option to override BH or directly forward to Head.

Can you help on this scenario.

Hi Paul,
Any response to above question, we are almost through with this tool, provided we show case few sample scenarios and we are few steps away from it. your help will make a big difference in completing this POC and get into next level of discussion.


There’s no nice way to model that in pure BPMN, so you’re going to have to do some custom extension to achieve it. Flowable has listeners, so you could listen to assignee changes and look up the group of the user that claimed the task and set a variable that you can test in the gateway. You could also make this a custom subtype of user task if it is a regular requirement. The way to do it in BPMN means creating 2 parallel tasks, one for group A another for group B and having boundary events to cancel one if the other gets completed.

However, this scenario looks more like a Case Management type of use case. You could use our CMMN engine to model this kind of thing - and still call processes when processes are needed.


As a follow up, here’s an example of something similar done in CMMN. You can call processes or other cases instead of just tasks as I have here.


With the First Repsonse stage, 2 tasks are created and assigned to separate candidate groups. Whoever claims and completes a task first results in the other group’s task being removed.

If the Case Worker task is completed, the Extra Review task in the Case Review stage is created. The Standard Review task can only be created if the Extra Review is completed or the Senior Case Worker task was completed. Then it all moves on to the Resove Case stage.

This makes the logic more clear to anyone trying to understand what’s going on, and is “directed” compared to the equivalent “throw/catch” you’d need to do in BPMN which throws into the ether for anything to catch.

Just as an idea. Maybe others have other suggestions.


Thanks a lot Paul, we are working on few internal design changes for getting the user management sorted. We are almost through, will share our findings and steps we followed on this group so that it will be of help to others. Thanks a lot for your help and will post if we have further questions.