Prevent Subtask Creation if Already Exists Postfunction

Hilary Adragna August 26, 2019

I've created a "Create Subtask on Transition" post-function in my workflow, but would like it to only create on the condition that a subtask with the same summary does not already exist. To do this, I've created the following subtask creation/condition combination:

Jira Subtask Conditions Question.png

This is intended to:

Count the number of subtasks that have summaries containing "Assign Author and Reviewer". If this count is 0, then create this subtask on transition. If this count is >=1, do not create this subtask and continue with the transition.

However, instead, it seems to be stopping the transition and looping back to the previous status.

I seem to have misunderstood something. Does anyone have any suggestions?

1 answer

0 votes
Pierre Ibrahim July 14, 2023

I recently stumbled on this looking to do something very similar but with issue types, only difference in my syntax is I did (adding the "^" prior to the field to check)

count(filterByPredicate(subtasks(), ^%{issue.issueType} = "Setup In Time Recording System")) = 0

That seems to work perfectly for me. 

Suggest an answer

Log in or Sign up to answer