In many places in BPMNs, such as in scripts or JUEL expressions, I have access to a predefined object called “execution”, which can be used to access variables, for example.
Does an execution object also exist in DMNs or, more precisely, in a literal expression of a DMN?
Background
I have a wrapper class for my process variables:
public class VariableWrapper {
private final VariableScope scope;
public VariableWrapper(VariableScope scope) {
this.scope = scope;
}
public String getAccountNumber() {
return scope.getVariable("accountNumber");
}
public void setAccountNumber(String value) {
scope.setVariable("accountNumber", value);
}
public String getAssignToUser() {
return scope.getVariable("assignToUser");
}
//...
}
In delegates and task listeners I can use it as follows:
public void execute(DelegateExecution execution) {
VariableWrapper vars = new VariableWrapper(execution);
vars.setAccountNumber("4711");
}
In a BPMN diagram I can use it for example by implementing a groovy script:
def vars = new my.package.VariableWrapper(execution); // 'execution' is predefined in the script context
println "Account: " + vars.getAccountNumber()
But in a DMN I didn’t find the predefined ‘execution’ object. However, all the process variables are in the context, but the ‘execution’ is missing. Does it simply have another name?
I’d like to create a literal expression that creates the ‘vars’ instance, and inject it into my decision table - see DemoDecision.dmn (2.7 KB)
But the execution fails with an exception: “javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: execution for class: Script3”