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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Customizing the "Sub-task" types based on the Issue type.

Requirement :

I have some Issue types under which sub-task issue types are defined.

Now I need to customize the sub-task issue types based on the Issue types.

Please any one provide the clue for this.

Also if any plug-in exist for this please specify.


17 answers

1 accepted

1 vote
Answer accepted

I guess that was what we all mentioned as not possible apart from writing some javascripts for manipulating the create sub-task issue screen like the one below. Add an if condition for the issuetype selected. (in that sample 100008 is the sub-task issue type id).

<script type='text/javascript'>
    var intervalID;
    AJS.$(document).ready(function () {

        AJS.$('#opsbar-operations_more').click(function () {

            AJS.$('#create-subtask').click(function () {

                intervalID = setInterval(clearSub, 1000);


            function clearSub() {


i hear you renjith. just was wondering if it might be possible cause i also had an solution like this with "Clone" function from inside "More Actions"

Like Marcel Nowakowski likes this

I am not able to get Message Custom Field though i installed ToolKit Plugin

and added it to a field configuration and associated to a project.

Why do you need a 'Message custom field' for adding javascript, you can add it to the description of any field or in annoucement banner.

Thanks Renjith, this approach make me to enter the script every time I create an issue.

Instead, I tried to analyze the blocking some subtasks in core code, I found a class file which is SubTaskBlockingCondition.class

it's java code look as follow

package com.atlassian.jira.workflow.condition;

import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.config.SubTaskManager;
import com.atlassian.jira.issue.Issue;
import com.opensymphony.module.propertyset.PropertySet;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.StringTokenizer;
import org.ofbiz.core.entity.GenericValue;

public class SubTaskBlockingCondition extends AbstractJiraCondition
public boolean passesCondition(Map transientVars, Map args, PropertySet ps)
Issue issue = getIssue(transientVars);
SubTaskManager subTaskManager = ComponentManager.getInstance().getSubTaskManager();

Collection subTasks = issue.getSubTasks();
boolean passCondition;
Iterator iterator;
if ((subTaskManager.isSubTasksEnabled()) && (!subTasks.isEmpty()))
passCondition = false;

for (iterator = subTasks.iterator(); iterator.hasNext(); )
GenericValue subTask = (GenericValue);

String statuses = (String)args.get("statuses");

StringTokenizer st = new StringTokenizer(statuses, ",");

while (st.hasMoreTokens())
String statusId = st.nextToken();

if (subTask.getString("status").equals(statusId))
passCondition = true;

passCondition = false;

if (!passCondition)
return false;
return true;

Is my approach right and am I looking the exact requirement thing?

Oh no, that script was for the announcement banner.

Regarding class that you are referring to, it is a workflow condition class, not used while creating issues.

2 votes
Tarun Sapra Community Leader Feb 03, 2015

Hi All,

One of the ways to implement this feature is to have a "loopback" workflow transition called "Create Subtask" , basically on the post-function of this transition you can create the sub-task using script runner plugin, though this way is more verbose but it kind of works well as the end-user sees the button "Create Subtask" clicks on this and the sub-tasks of a certain type can be generated.

Ah ok, that makes sense. But JIRA does not support it :( (Pending feature request here )

Probably you can do some javascript based solution to get rid of additional ones based on the issue typ.

I am not sure about your exact requirement. But you may like to have a look at this plugin -

Hope this helps you!

What do you want to customize? Screens? Transitions? Or the way sub-tasks are displayed in main task? Or auto closure of main-task?

I have defined a number of sub-tasks in a project under different issue types.

I need to retrieve

only those sub-tasks for bug type if I select 'sub-task for Bug',

only sub-tasks for New Feature if I select 'sub-task for New Feature' and soon.

How this is possible?

0 votes

If I understand this correctly, you want to restrict the available sub-tasks based on the issue type of the parent? For example, under "bugs" you only want to allow the sub-tasks of "feature" and "test", although your sub-task list is feature, test and action?

This is not currently possible directly, and I've not seen any plugins that will fix it. There are some ways to block people from creating the wrong types, but none that actually limit the list available. I think your options are to do something with javascript, or to start hacking core code. I'd also start with a look at the behaviours plugin, I don't know if it can meet this particular need, because I've not looked.

I'm trying to make a filter as follow

project = MyProject AND parent = MYP-1

--This implies in a project called MyProject, the subtasks are retrieved based on the parent key MYP-1(which is a bug type)--

Now I want to know Is there any method which returns a issue key when a issue type(bug) is given?

Which meant the issue key for a paritcular issue should be returned,

when I give the Bug issue type;

e.g:I defined number of issues of type Bug and each one have a separate Issue Key

I need to get those Keys.

I am lost :(

I didn't get what you meant by 'returns a issue key when a issue type is given'

Hope Nic understands what you meant.

0 votes

I'm still not quite understanding this.

I'm really not sure what filters have to do with the original question, but the answer to that is to use the "parent" function in JQL - see . A filter for "parent = myp-1" will work. If you only want "bug" sub tasks, then add the clause "and issuetype = bug"

MYP-1 is the issue key of an issue(Bug type)

Similarly another issue(Bug type) may have a key MYP-5

Suppose both of them has sub-tasks

If I am able to get those keys, then i can use

parent='MYP-1' or parent='MYP-5'

0 votes

Yes, correct.

Now I do not see where the question is. You can get teh subtasks for both of your issues with what you've just said.

Now I want to know Is there any method which returns a issue key when a issue type(bug) is given?

0 votes

I'm really struggling to understand what the question here is.

I've already pointed out that "issuetype = bug" is the clause you need to identify bugs.

The requirement just changed as:

I defined a number of sub-tasks issue types in a project like subtask1,subtask2,...,subtask10;

When I try to create a subtask,

I need to display subtask1,subtask5 for Bug

I need to display subtask4,subtask5 for New Feature

and soon.

i.e., let's consider bug type issue

then in More actions, I click create a sub-task for this?

then a window is displayed

and in it, I want to display only some sub-task issue types for bug type issue

How can this be achieved?

i think i've seen some question like this here before.

i believe the goal is to seperate the possibile sub-task issue-types depending on what the parent issue-type is.

am i right?

so lets check this scenario...maybe other will understand that one better

Issue-Types (Parent)



Issue-Types (Subtask)

"story task"

"bug task"

if your parent issue is a "Story" you only want to see "story task" as possible selection when you're creating a subtask

if your parent issue is a "Bug" you only want to see "bug task" as possible selection when you're creating a subtask

am i right so far?

100% correct and how can we achieve this?

well unfortunately that's not that you can read in the feature request i've posted above.

this is not a feature of jira and nobody knows if or when it will be integrated.

i am not sure but i think you could put some javascript inside a velocity processed message field to hide some sub-task issuetypes if the parent issue-type matches a certain selection.

if customfield "Message Custom Field (for edit)" will be shown during issue-creation you can add javascript to it where you set several conditions to hide/show. i believe you must use strings there

Suggest an answer

Log in or Sign up to answer

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you