New feature: JavaScript as process dialect
Blog: PROCESSES, RULES AND EVENTS
- As action script:
- Action script inside a Script Task
- On-entry or on-exit actions scripts (in tasks supporting these, e.g. user tasks, call activity, rule tasks, etc.)
- As constraint:
- In diverging gateways (to decide which branch to take)
Inside these JavaScript fragments, you automatically have access to various properties (similar to how Java and MVEL actions scripts work):
- Direct access to
- process variables
- globals
- A ‘kcontext‘ variable giving access to the ProcessContext (and through this you can get access to the active ProcessInstance, NodeInstance, KieSession, etc. and set variables)
For example, you could define an action script like:
kcontext.setVariable(‘surname’, “tester”);
var text = ‘Hello ‘;
print(text + kcontext.getVariable(‘name’) + ‘n’);
try {
somethingInvalid;
} catch(err) {
print(err + ‘n’);
}
// this is comment
print(person.name + ‘n’);
Or a constraint like:
person.name == ‘krisv’
Leave a Comment
You must be logged in to post a comment.