Is it possbile, that I declare in Modeller Variables like ints, Strings or something, that I can access while the Service Task is running ? What would a example code for Java Spring Boot ?
By default when you pass the variables from the ‘Input’ tab they become local variables .If you want some variable to be global you can use execution.setVariable('myGlobalVar;,‘this is global variable’)
I want to set the variable in Modeler, then I have it local in my Code (String duration = (String) execution.getLocalVariable(“duration”) , after I got it, I have to set it immediately with: execution.setVariable (“duration”, duration) in Code I think, or ?
Input/Output tabs are typically used for passing variables to a reusable function and the output parameter maps to a global variable . If all you need is a global variable you can add a scrip task and select javascript as format with mode inline and have the code in it as execution.setVariable(‘duration’,‘duration’)
Thanks, but I need a Possibility that I can set Variables in Modeler directly, without any knowing of Programming or Java Script Code, I can read this variable in Java Code and transform it to a global variable. It should possible, that another person without knowing Coding in Java/JavaScript or whatever Language easily use the Modeler for setting easily variables for the process and can switch variables like times duration in seconds with just change one value in Modeler.
building on @dineshsb’s last answer, you can simply create the output parameter as type Text and write the following expression as value: ${duration}. This will pick up the local variable called duration and make it available globally. The Name of the output parameter will then be the name of the variable in the global scope. No Java or JavaScript knowledge necessary.
Hint: It is usually advisable to have different names for the local variables in order to not get too confused with variable names. But it works nonetheless.