I`ve got a "library" with common functions, .../scripts/util/Helper.groovy:
package util
import .......
public class Helper {
public String getCurrentProjectKey() {
return issue.projectObject.key
}
}
And a script .../scripts/myscript.groovy:
import util.Helper
def helper = Helper
String currentProjectKey = helper.getCurrentProjectKey()
I use it as a post-function. But everytime I get an error or while checking either when running. The main problem is that "issue" object is not seen in library. I use different combination of code to make the "issue" object be recognizable, but nothing helps me...
For example, error:
file:/var/atlassian/application-data/jira/scripts/util/Helper.groovy: 29: Apparent variable 'issue' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
You attempted to reference a variable in the binding or an instance variable from a static context.
You misspelled a classname or statically imported field. Please check the spelling.
You attempted to use a method 'issue' but left out brackets in a place not allowed by the grammar.
How can I use "issue" object in my imported common libraries?
Or how can I get the current issue object?
Thanks in advance.