I am struggling with function which allow creating sub-task automatically after creation main task. I don't know why but all of those lines return null:
def issue = issue as MutableIssue
MutableIssue parent = issue.getParentObject() as MutableIssue
def parentIssue = issue.parentObject
def newSubTask = issueFactory.getIssue()
Issue issue = issue
I don't know how to get current issue and create subtask. This is my first experience with groovy and maybe somebody kindly help me with it. Thanks.