Main task followed by related tasks using Process model

Hi team,

I have a use case where I need to create tasks for users, but there is a parent-child relationship between tasks. In one interface, I will collect the details of the task, and users can add additional tasks to an already existing task. So, a parent task will have N number of child/related tasks, which will be stored in a table called "task details". Daily, once I trigger a process, it will query the task details and create the tasks. The thing I need is for the parent task to be created first, followed by related tasks in the order the user gave them. It would be simple to achieve this using a subprocess and looping the task creation by sorting the data using datetime. However, I wish to use the startprocess MNI, as it won't affect performance and to avoid instances paused by errors (subprocess will stop in this case). I don't know how to order the data or loop the data to achieve this. Any suggestions?

Thanks in advance

  

 
 

  Discussion posts and replies are publicly visible

  • 0
    Certified Associate Developer

    Hi,

    I'm not sure about the volume if these tasks, if the volume is too high go by record centric approach and do not trigger a tasks i.e "user input" task using process instance, as in longer run these active process instances will eat up your instance memory and causes slowness.

    If the volume is high better way to do this is by inserting the data into the DB with similar pattern on what you are expecting  to do with process and have an assignment column to whom this has to be assigned.  In site query this DB and show the list so that users can action on top of this and store the information.

  • 0
    Certified Senior Developer

    Hi   Currently there is no specific volume of the tasks mentioned. When you go with MNI process,  MNI takes more memory.t is not good when we are using more than 1000 iterations, consumes more storage.using MNI does spawn all instances on the same execution engine. This can be an issue with a large number of instances (especially if your MNI is run on a sub-process node) because it can create a load unbalance between multiple execution engines. You would think of an alternative approaches like record/database approach

  • 0
    Certified Lead Developer

    I would like to understand the purpose of this parent-to-many children task concept first. Are these child tasks really tasks, with their own due date, escalations, exceptions and life-cycle? Or is this more like a to-do list for the parent task?

  • 0
    Certified Senior Developer

    You're right, using a subprocess can introduce performance overhead and potential pausing issues.
    Try this

    Task Details Table:
    task_id (Primary Key)
    parent_task_id (Foreign Key referencing the parent task, can be null for the parent task itself)
    order (Numeric field to specify the order of child tasks, 1 for the first child, 2 for the second, etc.)

    Store tasks in a table with parent_task_id and an order field.
    Use start process MNI daily to: Query tasks, sort by parent_task_id then order.
    Loop through sorted data: If parent_task_id is null, create parent task.
    Else, create child task with the parent ID.

  • Hi Guys,

    The issue is solved. I will query the data from the task table and pass it for task creation using startprocess MNI and if a task doesn't have any FK relation it will proceed for task creation, else(child) it will for certain until it's parent task created.

  • Yes Stefan they are real tasks. Now I found a solution. In the table I will have a column that holds the relationship between parent-child ( like a foreign key). By using that I can identify whether it is a Parent or child. another one Boolean column I can identify task is created or not. If I trigger a startprocess MNI, all instances will execute at the same time, so using these I can control the task creation, once parent task is created the column will become true, so that child can proceed, until that time it will wait (few seconds)