cancel
Showing results for 
Search instead for 
Did you mean: 

how to define/set result variable from usertask?

deepak_singhvi
Champ in-the-making
Champ in-the-making
) In case i want to take out some of the variable out of all the variables passed at the time of process start, how to do it in the
in usertask.

What exactly i am looking for:

start -> task1 -> task2 (custom form) -> stop

passing a variable at the time of starting the process, lets say myvariable.
myvariable contains elements/keys like "a","b","c","d" and their respective values.

based on some business requirement i want to pass only "a" and "b" to the task2, so that same can be used in the form, which is a custom form. how to achive this. I could get these values in the description but how to set a new variable in the designer, again their type is Object.

b) where can i specify new variable through usertask.

c) How to update process variable using usertask, before the task gets completed. (i do not need listener/form to update the value).
Can this be done directly in the designer ?

how did i achieve this: I used  start -> task1 -> task1servicetask -> task2(custom form) -> task2servicetask -> stop

from the analyst point of view also i had to do more coding for service task creation and setting the result.
if the same can be achieve using the assignment operator, etc that its would be nice, the same way its there in WPS (BPEL). :idea:

Regards,
Deepak  Smiley Happy
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
If you want to have variables that are kept LOCAL to a task, use the "setVariableLocal" on DelegateTask and "setTaskVariableLocal" on RuntimeService/TaskService. This way, the next task won't have access to those variables. If you want SOME of those variables exposed for the next task (or for the whole process, copy the variables to the process-instance or execution using the regular setVariables() methods. This can be done when the task is completed, using a listener.