Declaring variables in Script Task through execution.setVariable and using them in the User Task.
I have declared a variable in Script Task using execution.setVariable in the activiti Designer, but when i use the same variable through the ${expression} in the usertask and i click on the submit button when the process is run it says unable to evaluate expression.
This is what i have done.
Script Task:
message = "Hello"
execution.setVariable("msg", message)
User Task
Form Properities (String):
Expression:
${msg}
Format of the script is groovy.
Please Advice
Solved! Go to Solution.
Thankyou so much Jonathan, i will look in to the variable section. Further more i figured out another way, there is a field where you can name a variable in the form properties right under the expression field, so i gave a name over there and it worked like a charm.
Asheer,
I believe when you use: execution.setVariable("msg", message), that's meant to set a Process Variables. From my understanding Activiti will not define a new variable for you if it doesn't already exist in the process, for example that "msg" value in your script. You would need to have a Process Variable named msg in order to store that information there.
Below is a GUI method for declaring a process variable:
Feel free to look into the Variables section of the User Guide for more specifics on utilization and declarations.
Hope this helps,
-JEarles
Thankyou so much Jonathan, i will look in to the variable section. Further more i figured out another way, there is a field where you can name a variable in the form properties right under the expression field, so i gave a name over there and it worked like a charm.
Hi Jonathan,
I looked out for the Variable in the GUI shown above in your screenshot, but my designer doesn't show that option.
I'm currently using Activiti Explorer 5.22.
Thanks.
Thank you for help
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.