Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

prevent subtask creation/issue creation.


Hi Team,

i need help for few of my questions and if its possible then how to implement them .

In JIRA workflow for my client ,i have created grrovy script that creates subtask when parent issue is created but now i wanted to add some constraints when a manual subtask is being created for a parent issue.

1. if autocreated subtask exists with same summary then manually new subtask  should not be created.

2. if my parent issue is makred to done then also it should not allow to create a new subtask manually.

3. parent issue is marked to done, once all subtasks are done then subtasks should not be allowd to move into other status even if transition from done to inprogress does exist.


Kinldy provide some code or scripts that can help me achiving above mentioned points.


Thanks in advance !

1 answer

1 accepted

2 votes
Answer accepted
Aidan Derossett _Adaptavist_
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 25, 2017

Hey there, I think I have a viable solution for each of your requests. So I'll go through each one-by-one:

1. For your first requirment, it would be easiest to hide the Create-Subtask UI element using one of the built in Script Fragments. You can find these by pressing the "." (period) key while in your JIRA instance and searching for "Script Fragments." The fragment that you want to add is "Hide system or plugin UI element." Once you are in the creation screen for that fragment, add this code to the "Condition" block:


def currentStatus =

!(currentStatus == "Done")

And select the create-subtask element from the web-items to hide. The code states that if an issue is in the "Done" status, then the Create-Subtask option will not appear on the issue view screen. Additionally, if you would like to do more than just remove the option from view, you can add a script validator to the Create transition, similar to the route I take below.

2. For your second requirment, you need to make a simple script validator on the Create transition in your workflow (if you need assistance in setting that up, let me know). The condition you use should look something like this:

    def issueParent = issue.getParentObject()
    def parentSubTasks = issueParent.getSubTaskObjects()
    def currentSubTaskSummary = issue.getSummary()
    !parentSubTasks.find{it.getSummary() == currentSubTaskSummary}

This condition checks every other subtask assigned to its parent issue and ensures that the subtask being created is not a duplicate. Add an appropriate error message and leave the Field box blank (make sure you publish the workflow after adding the validator).

3. For your third requirment, you need to add another workflow validator to every transition that is not your "Done" transition. I wasen't quite sure what you were asking for in the third point, so this is what I came up with:

    if(issue.getParentObject() == "Done")
        ! == "Done"

This condition essentially makes it so that a subtask cannot transition to the status associated with this validator if its parent's status is set to "Done." Again, add the appropriate error message and leave the Field box blank. Just to reiterate, this validator must be added to every transition that is not your "Done" transition to ensure that a subtask cannot be set to any of those statuses.

That's all I've got! Let me know if you need help or further clarification with any of this!





Hi Aiden - i have similar need for the first one but instead of stopping manual sub-task from being created, i want to stop a duplicate from being created on the transition (if the workflow went back a step and then forward again).

any ideas on this one? 



Aidan Derossett _Adaptavist_
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.
Sep 21, 2017

Hey Tracey!

Assuming you are using the Create Subtask SR post-function, you should be able to use a condition like this to check if the issue already has a subtask with the given summary:

import com.atlassian.jira.component.ComponentAccessor

def subtasks = issue.subTaskObjects
if(subtasks.find{it.summary == "Subtask Summary"})
return false
return true

Hi Aidan,

I have the exact requirement to prevent sub-task creation(1 issue in the above question)  so can you please guide me where do i need to add this code in script runner as i am new to jira cloud.




Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events