As I known, there is no scope for task. you could only create a scope for an Activity. Of course, we could set a variable into task. but this variable will also be set to the related execution. Even if the task completed, the variable won't be removed.

Shannon, sorry for being not clear about that by "programmatically" I meant that you have to do it in Java code and I see no way to do it in the jDPL definition, variables in jPDL are execution scoped like HuiSheng said.

HuiSheng, I hacked that in my project but I have other customizations too, so not sure if this works in a plain jBPM4.4, however the variable table in the database is linked to the task with a hibernate map definition that has cascade="all-delete-orphan" so the variable should be deleted when the task is removed from the task table... but I am still trying to figure out the details

I understood what you meant - I'm willing to create a java class create task variables - however - I'd like to define these values in the jdpl - is there any elements of a task or a transition I can stick the values in where I can grab them during the task initialization to create the variable. I hope I'm making sense.

From my review of the links above - I'd either have to create my own custom Task node containing my task-variable node (which scares me) or create a Task Variable node - which somehow would look up a corresponding Task upon creation - which seems sloppy. Which is the preferred method or should I just wait for a future release containing this feature?