1 Reply Latest reply on Dec 23, 2010 2:55 AM by Michael Wohlfart

    jBPM 4: Programmatically create Tasks and map them to process instance id

    Prachi M Newbie

      Hello Everyone,

       

      I am using jBPM 4.3 and need to create a task using jBPM APIs. The number of tasks are not defined during process deployment, hence every execution of the process should be able to create some number of tasks dynamically.

       

      As given in the developer guide, I am using the below snippet:

       

      Task newTask = taskService.newTask();
      newTask.setAssignee("manager");
      newTask.setName("Dummy sub task");
      taskService.saveTask(newTask);
      

       

      The task gets created successfully, however in JBPM4_TASK table, the processinstance_id, execution_id etc parameters get saved as null.

      I need to map the newly created task with the process instance id so that when I query the tasks for a particular execution id, I get this task listed as well.

       

      Please provide some pointers on how can I avoid the null values getting persisted in the database.

       

      Thanks in advance.

       

      --

      Prachi