I’m trying to write a groovy script to onboard a new user. This involves calling several Spring services but I’m having problems assigning the return value of a service call to a variable (I need to call subsequent services with the return values from previous service calls)
Example script:
${personService.createPerson(name)}
return true
Calling ${personService.createPerson(name)} works but changing it to:
person = ${personService.createPerson(name)}
return true
results in the following exception:
09:50:17.780 [main] ERROR org.camunda.bpm.engine.context - ENGINE-16004 Exception while closing command context: Unable to evaluate script: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.$() is applicable for argument types: (Script1$_run_closure1) values: [Script1$_run_closure1@4f9e32f2]
Possible solutions: is(java.lang.Object), any(), get(java.lang.String), any(groovy.lang.Closure), use([Ljava.lang.Object;), wait()
org.camunda.bpm.engine.ScriptEvaluationException: Unable to evaluate script: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.$() is applicable for argument types: (Script1$_run_closure1) values: [Script1$_run_closure1@4f9e32f2]
Possible solutions: is(java.lang.Object), any(), get(java.lang.String), any(groovy.lang.Closure), use([Ljava.lang.Object;), wait()
Is the Problem that the ${} expression doesn’t return a value?
can you please share your complete script and BPMN process?
If you want to assign the result then you may use an output mapping (or result variable if it’s a script task).
You can’t write a script like this myVar = ${script expression}.
I tried the “fix” for spring boot applications but still the same problem
I’ll try to put together a minimal spring boot project and see if it has something to do with the configuration.