Page tree

You are viewing documentation for Structure Server and Data Center version 5.5 and patch releases. For other versions, see Version Index or Structure Cloud.

Skip to end of metadata
Go to start of metadata

Running the following script you can create a new structure.


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

@Grab(group = 'com.almworks.jira.structure', module = 'structure-api', version = '16.9.0')


StructureComponents structureComponents

def structureManager = structureComponents.getStructureManager()

def permission = PermissionLevel.valueOf("ADMIN")

// It is important to check if an existing structure already exists; otherwise, this will create a new structure with the same name.
if (structureManager.getStructuresByName("testScript", permission).isEmpty()){
log.warn "no existing Structure found"
// It is important to note that without the saveChanges() call at the end, the new structure won't be saved to the database and will disappear after the script is run.
} else {
log.warn "found a pre-existing structure"

  • No labels