stop creating sub-task if sub-task is already created.

Jigar D Patel March 19, 2018

Hello,

My end goal here is to stop generating sub-task, if sub-task is already created. 

This is how my work-flow is set up. 

Opening parent ticket creates 5 sub-task using post function. I separated 5 sub-task into separate issue-types, so they all have separate workflow. On one of the sub-task issuetype work-flow when sub-task is resolved, it will create 5 more sub-task. 

There are times user might re-open sub-task and resolving again will create 5 more sub-task, so I am trying to avoid creating sub-task, if it's already created. 

Can you please suggest any post-function, Condition or Trigger? 

As of now, I have below Add-ons installed:
Bob Swift Atlassian Add-ons - Create on Transition
JIRA Misc Workflow Extensions
Adaptavist ScriptRunner for JIRA
Automation Tools for JIRA LITE

2 answers

0 votes
Brittany Wispell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 19, 2018

Hey @Jigar D Patel

You could put a condition with the creation of the sub-tasks to look for sub-tasks with a specific issuetype or summary. If there are then it won't create.

Jigar D Patel March 20, 2018

@Brittany Wispell - Can you help me with condition? Let's say 5 different task is using same issue type called sub-task, but the each sub-task summary is different, which includes %parent_summary% - and keywork for those task. 

Jigar D Patel March 22, 2018

@Brittany Wispell - Can you please help me set this condition?

Brittany Wispell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 22, 2018

Yes @Jigar D Patel 

I will work on it right now and get back to you by the end of the day. 

Brittany Wispell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 22, 2018

Hey @Jigar D Patel

You'll need to put this in the Sub-Task creation post function. See code below. See image example on where to put the code. Let me know if you need more help! 

boolean doesSuchASubtaskExist = issue.getSubtaskObjects().any{it.summary == "Replace this"}
if (!doesSuchASubtaskExist) {
return true
} else {
return false
}

 Screen Shot 2018-03-22 at 2.48.42 PM.png

0 votes
Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 19, 2018

I am very surprised by this requirement of yours "On one of the sub-task issuetype work-flow when sub-task is resolved, it will create 5 more sub-task. ". Why is resolving an sub-task creating more subtasks? What's the Business case behind it. Using plugins which you have mentioned you can achieve the original requirement but why built such an complex system which will become an maintenance nightmare.

Jigar D Patel March 20, 2018

Hello Tarun,

Some task depended on others and we do not want o assign work without the previous work is completed. 

Suggest an answer

Log in or Sign up to answer