as you already give the task you want to add you should have the task id set in the object you used as parameter (task.getId())... sometimes it is just too easy...
task.getId()
Reply to this message by going to Community
Start a new discussion in jBPM at Community