Hi all,
I am trying to write a script via script runner plugin to insert an issue into a structure within a worklog transition. I am using the official Aptavist Script Runner Example to "Add Issue to Structure on Transition" but I always get the folowing error:
com.almworks.jira.structure.api.error.StructureException: No access to item com.almworks.jira.structure:type-issue - structure ITEM_NOT_EXISTS_OR_NOT_ACCESSIBLE
What could be the reason?
Thanks,
Richard
...
StructureComponents structureComponents
def structureManager = structureComponents.getStructureManager()
def forestService = structureComponents.getForestService()
Issue issue = issue
def structures = structureManager.getStructuresByName("XXX", PermissionLevel.ADMIN)
if (structures) {
def structureId = structures.first().id
forestService.getForestSource(ForestSpec.structure(structureId))
.apply(new ForestAction.Add(CoreIdentities.issue(issue.id), 0, 0, 0))
}