# How to add a task by code in a complex process?

**URL:** <https://forum.flowable.org/t/how-to-add-a-task-by-code-in-a-complex-process/10953>\
**Category:** Flowable Engine\
**Created:** [October 23, 2023, 3:16pm UTC](https://forum.flowable.org/t/how-to-add-a-task-by-code-in-a-complex-process/10953 "2023-10-23T15:16:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Olipool](https://avatars.discourse-cdn.com/v4/letter/o/50afbb/32.png) [@Olipool](https://forum.flowable.org/u/Olipool)\
**Post date:** [October 23, 2023, 3:16pm UTC](https://forum.flowable.org/t/how-to-add-a-task-by-code-in-a-complex-process/10953/1 "2023-10-23T15:16:08Z")

</div>

Hi all,

I have a somewhat “complex” process containing subprocesses etc. and at one point in a subprocess, tasks get generated for a list of users that come from a user provider. These tasks are then being worked on by users for a few weeks and the problem now is that there may be new users to the company and they should also work on those tasks.  
So I need to create an additional task for the new user and at first I thought of doing that directly in the database but the task structure is more complicated than I thought. Then, I found the “DynamicUserTaskBuilder” and that allows me to create a new task but I am really lost on how to move it to the right position in the execution tree (so that it is part of a subprocess or inner loop). Also, I need to add all process variables to the task.  
So my question is, can I do something similar to extending my user provider and then tell flowable to enter the node in the process again and only create tasks for new users? I can fiddle around a bit more but it is a complex engine and I am afraid of missing some detail that will lead to errors much later in the graph/tree.

Thanks for any input!
