JBoss Community

get the task id in human task handler

created by Odelya Holiday in jBPM - View the full discussion

Hi!

 

In my application I create a custom human task handler that sends web service to external program with the current human task id.

 

I tried to extract the task by adding after this:

 

 

client.addTask(task, content, null);
 
Long taskId = task.getId();

 

 

taskId is always 0!

 

I think that it's because I wrap my process in one transaction - so it doesn't save to database the task until the process finished.

 

 

UserTransaction ut =
 
  (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );
 
ut.begin();
 
ksession.startProcess( "MyProcess" );
 
 
// commit the transaction
 
ut.commit()
 
 

 

 

I believe that I can't create transaction inside transaction - so how can I retrieve the task id within the human task handler  in order to use it for future task complete purposes?

 

how do you recommend to use transactions otherwise?

Reply to this message by going to Community

Start a new discussion in jBPM at Community