Here is a minimal example for listing structures from the Structure plugin. The comments in the script give more information about the important elements.

import com.almworks.jira.structure.api.PermissionLevel
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.almworks.jira.structure.api.StructureServices

// Grab only useful for IDE help, not for runtime. Alternatively you can just add this jar to the
// "provided" scope for the module
@Grab(group = 'com.almworks.jira.structure', module = 'structure-api', version = '8.4.0')

// Specify that classes from this plugin should be available to this script

// Inject plugin module
StructureServices structureServices

    The script itself follows...
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def structureManager = structureServices.getStructureManager()
def structures = structureManager.getAllStructures(user, PermissionLevel.VIEW, false)
structures.each {structure ->
    log.debug("Structure: ID: ${}, name: ${}")

Add Issue to Structure on Transition

Here is another example with Structure, a post-function which adds the current current issue to a named structure. You might want this done automatically when the issue has been triaged or CCB’d…​ you may not wish to consider it in your structure before this point:

All Descendants Must be Resolved Condition

Another example, a condition whereby all descendant issues in all structures containing this issue must be resolved. This is just for illustrative purposes and not necessarily a good idea, or production code:

For how-to questions please ask on Atlassian Answers where there is a very active community. Adaptavist staff are also likely to respond there.

Ask a question about ScriptRunner for JIRA, for for Bitbucket Server, or for Confluence.