I'm not a developer and could use some help.
I'm trying to look at all subtasks on a parent issue and use a post function on the "Pass" transition to find the next subtask, look at who it is assigned to, and reassign the parent issue to the person assigned to the next subtask.
For example,
Parent - ParentAssignee
- Subtask1 - Subtask1Assignee - Status is Done
- Subtask2 - Subtask2Assignee - just transition through Pass transition
- Subtask3 - Subtask3Assignee
If the user moves Subtask2 through Pass, as a postfunction, I want to look at Subtask3 and see who it is assigned to (Subtask3Assignee) and then reassign the parent to Subtask3Assignee.
I've pulled together code from various things I've done before and have successfully gotten a list of subtasks, my current issue is changing the subtask number that is an integer, back to the subtask key to then get the assignee.
Here's what I have so far that is cycling through the subtasks:
import com.atlassian.jira.component.ComponentAccessor
log.setLevel(org.apache.log4j.Level.DEBUG)
def issue = ComponentAccessor.issueManager.getIssueByCurrentKey("OAK-25198")
log.debug "issue is $issue"
def parent = issue.getParentObject()
log.debug "parent issue is $parent"
def subTasks = parent.getSubTaskObjects()
for (int i = 0; i < subTasks.size(); i++) {
def subtaskNumber = subTasks[i].getKey().findAll( /\d+/ )*.toInteger()[0]
log.debug "subtaskNumber is $subtaskNumber"
def nextSubtaskNumber = subtaskNumber + 1
log.debug "Next subtask Issue number is $nextSubtaskNumber"
}
My log looks as follows:
2021-07-21 16:20:38,654 DEBUG [runner.ScriptBindingsManager]: issue is OAK-25198 2021-07-21 16:20:38,658 DEBUG [runner.ScriptBindingsManager]: parent issue is OAK-25197 2021-07-21 16:20:38,661 DEBUG [runner.ScriptBindingsManager]: subtaskNumber is 25198 2021-07-21 16:20:38,661 DEBUG [runner.ScriptBindingsManager]: Next subtask Issue number is 25199 2021-07-21 16:20:38,661 DEBUG [runner.ScriptBindingsManager]: subtaskNumber is 25200 2021-07-21 16:20:38,661 DEBUG [runner.ScriptBindingsManager]: Next subtask Issue number is 25201 2021-07-21 16:20:38,661 DEBUG [runner.ScriptBindingsManager]: subtaskNumber is 25199 2021-07-21 16:20:38,661 DEBUG [runner.ScriptBindingsManager]: Next subtask Issue number is 25200
So I'm able to cycle through the subtasks, and add 1 to the subtask to find the next one. The problem is, my issue key is an integer. So I think I need to get it back to an issue key and then find the assignee on nextSubtaskNumber.
I've tried a couple of things, but no luck yet. Any developers out there able to help me? 
Many thanks!!
Laurie