¿How to store and access configuration data in Jira for Groovy Scripts?

1. Place a file with name credentials.properties Under <script_root> : app.url=http://example.com app.user=myuser app.password=secret 2. Create an Accessor class in <script_root>/mycompany/MyCompanyProperties.groovy: package mycompany import com.onresolve.scriptrunner.runner.ScriptRunner import com.onresolve.scriptrunner.runner.ScriptRunnerImpl import java.nio.file.Files import java.io.File import groovy.util.logging.Log4j @Singleton @Log4j public class MyCompanyProperties {     final String configFileName = ‘credentials.properties’     public Properties getProperties() {         def scriptRoots = ScriptRunnerImpl.getPluginComponent(ScriptRunner).getRootsForDisplay()?.split(“, “)?.toList()…

Read More

ScriptRunner for Jira – Script Fields trick to use Common Classes

For a large scripts exist a trick to reduce the complexity of the Script Fields if you use classes that can be “common” and reused between other Script Fields. For example, imagine we want to create a Script field that show a report HTML inside the tickets with the Lean metrics. Something like this: And…

Read More