While moving to in progress, sub-tasks would be created for each application selected in Application Name (multiselect)
Summary: <App_Name> - Subtask
Select List 1 : Value from parent task
Text 1: Value from parent task
Number 1: Value from parent task"
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
def parentIssue = sourceIssue
int numMarkups
doAfterCreate = {
if (parentIssue.getIssueType().getName() != 'Task')
{return}
if (parentIssue.summary.contains("Markup Master Task"))
{
numMarkups = Integer.parseInt(parentIssue.summary);
}
if (numMarkups >= 50)
{
return
}
else
{
def i = 0
def issueFactory = ComponentAccessor.getIssueFactory()
def subTaskManager = ComponentAccessor.getSubTaskManager()
def constantManager = ComponentAccessor.getConstantsManager()
def issueManager = ComponentAccessor.getIssueManager()
for (i; i < numMarkups; i++)
{
MutableIssue newSubTask = issueFactory.getIssue()
newSubTask.setSummary("Markup" + i.toString())
newSubTask.assignee == parentIssue.assignee
newSubTask.components == parentIssue.getComponents()
newSubTask.setParentObject(parentIssue)
newSubTask.setPriorityId(constantManager.getPriorities().find {
it.getName() == "P2" }.id)
newSubTask.setProjectObject(parentIssue.getProjectObject())
newSubTask.setIssueTypeId(constantManager.getAllIssueTypeObjects().find{
it.getName() == "Sub-task" }.id) }
}
}
}