I have a user defined function in a groovy script I keep in the Script Editor file list that I want to call from post function scripts also stored in the Script Editor list. My objective is to maintain one copy of the function that can be used across scripts (post functions). I have included the method's declaration to simplify the discussion.
def TransitionLinkedIssues(com.atlassian.jira.issue.Issue issue, String targetLinkTypeName, String targetCategoryName, String targetTransitionName) {
...
}
Hi @Jeff Abbott
You should create a folder in the jira directory: "Scripts" and store the scripts there.
Then in the groovy using the postfunctions or other you can call the function from using in the script.
import util. <your_groovy_name>
// and then call your function or method
<your_groovy_name> .functionName ()
I hope it helps you, you can find the documentation in Script Roots
Hi @Jeff Abbott
we store our util classes in Script Editor
Then access them from other other scripts
e.g. this is a workflow post function using the above
import com.cheil.retail.ShoptectConstants
import com.cheil.retail.ShoptectSubTaskHandler
import org.apache.log4j.Logger
def logit = Logger.getLogger("com.cheil.eu.logging")
ShoptectSubTaskHandler handler = new ShoptectSubTaskHandler(issue)
logit.info(handler)
handler.createSubTasks()
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.