-
1. Re: kcontext.setVariable("variable",value) for begin used by following tasks?
salaboy21 Apr 16, 2012 5:17 AM (in response to gigazhang)1 of 1 people found this helpfulWhat are you trying to achieve? Usually that's not something that you want to do. The business process is defined by business analyst who assign people or groups to their tasks.
Do you really need to do that assignment using just one variable? I mean. you can.. but it sounds odd and not really representative for a real use case.
You can use on-entry and on-exit actions to change that variables from your nodes.. but once again.. I don't really recommend going in that direction, not because you can't but you probably don't want to do that in the long run.
Cheers
-
2. Re: kcontext.setVariable("variable",value) for begin used by following tasks?
knevik Jul 10, 2012 4:06 AM (in response to gigazhang)1 of 1 people found this helpfulif you do want to set a variable in the workflow use the following code
kcontext.setVariable("userId", "user"); //where userId is the variable name and user is the name of the user
this can be put in either a script task of its own, or in the on-entry or on-exit event of another task
<userTask id="_5" name="Human Task" >
<extensionElements>
<tns:onEntry-script scriptFormat="http://www.java.com/java">
<script>
kcontext.setVariable("userId", "user");
</script>
</tns:onEntry-script>
</extensionElements>
<ioSpecification>
...
</userTask>