Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to prevent the creation of sub-tasks when the status is changed to the same status.

Lakshmi CH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 30, 2025

Hi Team,

I added a post function to create or clone issues, specifically to generate a subtask from a Task issue type when certain conditions are met during a specific transition. Currently, all workflow statuses are set to "All." When a ticket is moved to that status, a subtask is created, which is working as intended. However, if the user moves the ticket back to the same status, it creates another subtask.

How can we prevent the creation of duplicate subtasks for the same ticket? We only need one subtask to be created when specific conditions are met the first time the ticket moves to that status. What condition should we set to achieve this?

1 answer

1 accepted

1 vote
Answer accepted
Hector Florin _Appfire_
Contributor
April 30, 2025

Hello @Lakshmi CH ,

I hope you're doing well.

Yes, you can achieve it; what you need to do is go to your clone issues post-function and edit it.
At the bottom of the screen you'll find a checkbox to add a condition using a Groovy script.

 

For example you can condition to only create a subtask if there is no existing subtask with the summary "Auto-generated Subtask" on the current issue.


!issue.getSubTaskObjects().any { it.issueType.name == "Sub-task" && it.summary == "Auto-generated Subtask" }

 

postfunction.png

If you want to explore more about it or have other questions related to the product JMWE or any other Appfire product, just open a support ticket, and the team will be happy to help.

 Appfire support portal

 

Thank you,

Regards,
Hector

Lakshmi CH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 1, 2025 edited

Hi @Hector Florin _Appfire_ , Thank you for your quick response.

It's working as expected.

I slightly changed it to 

(!issue.getSubTaskObjects().any { it.issueType.name == "Sub-task" && it.summary.contains("Summary wording") })

Like Hector Florin _Appfire_ likes this

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, loom, loom for training, loom for teaching, video training, async learning, online education, screen recording, loom tutorials, loom use cases, atlassian learning, team training tools, instructional video, virtual training tools

🛗 Elevate Your Training and Enablement with Loom

Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!

Register today
AUG Leaders

Atlassian Community Events