I need to check if a process variable is empty so that I can keep a running total of tasks in my process.
I have a local process variable named totaltasks of type integer.
In my script I simply check if this variable is empty or null and then base the rest of the script off this:
//If process variable has never been initialised
if( execution.getVariable("totaltasks") === null && execution.getVariable("totaltasks") === 'undefined' ) {
//set default value to 1 and initialise it
int totalTasks = 1;
execution.setVariable("totaltasks", totalTasks);
}
else {
//otherwise, just increment the current value
int totalTasks = (int)execution.getVariable("totaltasks");
totalTasks += 1;
execution.setVariable("totaltasks", totalTasks);
}
The code looks solid but I get the following error in my console:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.activiti.engine.ActivitiException: problem evaluating script: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: General error during class generation: null. Script6.groovy
What am I doing wrong here?