Blocking of Auto sub-task creation if subtask in parent with same summary already exists?

I have set up auto-sub task creation using post functions on a couple of transitions in our workflow. However, I our workflow can go back and forth between stages, and therefore i only want the sub-tasks to create the first time it gets transitioned.

Is there a script that i can use in the condition section of the post-script auto-sub task function that will only create the sub-task if a sub-task with the same summary doesn’t already exist on the Parent?  If it does exist, then the sub task wont’ create, but if sub-task doesn’t already exist, then it will create.

 thanks

Tracey

1 answer

0 vote
Mizan Community Champion Sep 18, 2017

You will need to add a condition on your subtask creation workflow postfunction.

The condition may look like below

(PLEASE NOTE : THIS IS NOT  A WORKING SCRIPT JUST FOR YOUR REFERENCE , I have not tested this , it may or may not work . Please try on your test instance)

for( def subtask in issue.subTaskObjects){
if(subtask.summary == "your summary")
return false
}

thanks Mizan - yeah i know i need a condition but not sure how to write the script. I tried your example above but it didn't work. It blocks the sub-task from creating at all on the transition, even if one doesn't exist already.  hopefully someone has been able to do this successfully and can provide the exact script. 

 

thanks for your help. 

Mizan Community Champion Sep 19, 2017

All the best :)

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

24 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you