Hi, I have a question regarding the use of Script Variables (from ScriptRunner plugin) depending on the project they are accessed. For instance, I know that if I define a variable calle MY_TEST_VAR I can access it from a script:
def myVar = MY_TEST_VAR
If I define these variables:
MY_TEST_VAR_PRJ000001 = "Value for project PRJ000001"
MY_TEST_VAR_PRJ000002 = "Value for project PRJ000002"
Could them be read in a dynamic way? Something similar to this:
def myVar = MY_TEST_VAR_${issue.project.key}
Thanks!
I published a reply to Dick's message as it was a reply to my own message and I can't delete it, so I have edited the original message and I will post the reply as soon as it allows me to do it.
Ciao Sergio,
Smart values come with double curly braces, as per this link for syntax. That might solve your issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: Script1.MY_TEST_VAR_() is applicable for argument types: (Script1$_run_closure1) values: [Script1$_run_closure1@78f8bea2]
at ConsoleScriptExecution1_groovyProxy.run(Unknown Source)
{
"delegate": {
"binding": {
"variables": {
"MY_TEST_VAR_PRJ000001": "Value for project PRJ000001",
"MY_TEST_VAR_PRJ000002": "Value for project PRJ000002"
...
binding.variables["MY_TEST_VAR_PRJ000001"]
binding.variables["MY_TEST_VAR_" + ${issue.fields.project.key}]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.