I'm using the built-in custom listener script 'Create a sub-task' and I follow the guidance here.
I have set the trigger events to Issue Created and Issue Updated. And whenever the parent issue is either created or updated with a custom field value = xyz, it will create the subtasks. Works like charm.
But now, every time the parent issue is updated on any field, it will create more sub-tasks.
I cannot share a screenshot but my code looks like this
Under Conditions:
def cf = customFieldManager.getCustomFieldObjectsByName("Radio Button")
def cfValue = cf.getAt(0).getValue(issue)
if (issue.issueType.name == "Bug" &&
cfValue.toString().equals("XYZ") &&
issue.getSubtaskObjects().find {it.summary() != "Custom summary here"}){
return true
}Target issue set to 'sub-task',
copy all fields,
under Additional issue actions:
issue.summary = 'Custom summary here'
I've also tried using 'Subtask Action' and set it to 'Done', but the script still auto creates more subtasks as "To Do".
What do I need to add if I want the built-in script to search via the summary, and if that subtask summary already exist, then it will not create?