We have Parent_Issue_#1 working by Workflow_#1 (if workflow maters).
Parent_Issue_#1 has Sub-task_#1. Sub-task_#1 works by Workflow_#2 (if workflow maters).
We have to create a Sub-task_#2 for Parent_Issue_#1.
"Create a sub-task" have to be triggered from Sub-task_#1 on one of its workflow (Workflow_#2) transition.
Result should look like:
└ Sub-task_#1 (creates Sub-task_#2 at one of its workflow transitions)
We try to achieve it via ScriptRunner scripted post-function.
How can I point at parent issue to be able to create a sub-task in my case?
Edited (removed some code because understood it was wrong).
Managed to do what i need:
def issueFactory = ComponentAccessor.getIssueFactory();
def constantManager = ComponentAccessor.getConstantsManager();
def issueManager = ComponentAccessor.getIssueManager();
def subTaskManager = ComponentAccessor.getSubTaskManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getUser()
Issue parentIssue = issue.getParentObject();
MutableIssue newSubTask = issueFactory.getIssue();
it.getName() == "Sub-task"
Map<String,Object> newIssueParams = ["issue" : newSubTask] as Map<String,Object>
subTaskManager.createSubTaskIssueLink(parentIssue, newSubTask, user.directoryUser)
Thanks to the code provided by Thanos Batagiannis: https://community.atlassian.com/t5/Answers-Developer-Questions/Hi-Can-any-one-guide-me-how-to-create-Subtasks-in-post-function/qaq-p/493429
Teams break work down in order to help simplify complex tasks. This is often done iteratively, with tasks being broken down into smaller tasks and so on until the work is accurately captured in well-...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events