2 Replies Latest reply on Sep 7, 2007 1:00 AM by cheets

    problem in taskInstance.end()

    cheets

      Hi All,
      In my workflow, i have to save some variables before ending a task. For this i use:

      taskInstance.setVariable("var1",value);
      taskInstance.end();
      jbpmcontext.save(taskInstance);
      jbpmContext.close();
      


      the problem i am facing is that as soon as taskInstance.end() is encountered, the control moves to the next node in the workflow, which is a decision node. the variable is not committed at this stage, so the decision fails.

      I tried closing the jbpmcontext after setVariable(), which persists the variable. But again, as soon as taskInstance.end() is encountered, it moves to the next node, so the current task keeps shoeing END_ as null. I am confused whther this is an expected behaviour or am i doing some mistake.

      the taskInstance i get as
      if (processId != null)
       {
       processInstance = jbpmContext.loadProcessInstance(processId.longValue());
       }
       if (processInstance != null)
       {
       TaskMgmtInstance tmi = processInstance.getTaskMgmtInstance();
       Collection taskInstances = tmi.getTaskInstances();
       //get all taskinstances for the selected processInstance
       for (Iterator itr = taskInstances.iterator(); itr.hasNext();)
       {
       task = (TaskInstance) itr.next();
       taskInstance = jbpmContext.getTaskInstanceForUpdate(task.getId());
      //get an updatable taskInstance.
       }
       }
      
      


      thanks in advance...