How to Restrict Creation of Subtask based on IssueType in JIRA ??

Hi,

How to restrict creation of subtask based parent issue type. ?? If its issue type 'A' i dont want people to create subtask for it. Issue type 'A' is main issue type.

In the UI itself i dont want to see a link to create subtask.

 

Help me !!!!!

3 answers

1 accepted

4 votes
Accepted answer

See https://jira.atlassian.com/browse/JRA-7990, where Denis Yaparov has provided a nice solution via (script runner) simple validation on Create issue transition's validator event

 

This simple scripted validator on Create transition in sub-issue workflow could do required check:

["Task", "Bug"].contains(issue.parentObject?.issueTypeObject.name)

 

 

Thanks for providing this answer Ben ....

And for those trying to get it working for JIRA 7 the syntax has changed slightly to:

["Task", "Bug"].contains(issue.parentObject?.issueType.name)

regards, Mark.

hi ! i'm having issues with this.. how does it work? 

Between [] goes the parent issue type?

i did that but it doesn't work for me ! i have jira 7.6 by the way..

@osvaldo plabst By entering Task, Story between [ ] you are limiting which issue types can be used to create sub-tasks. 

 

For Example if you type "Epic" between [ ], you are only allowing sub-task creation under Epic and restricting sub-task creation under all other issue types.

Ben

Thanks for your answer. I have one issue in this

This script will run different workflows for different sub tasks.

in my case i have same workflow for all sub-task types how i need to modify this script.

Hi! If you have sources - you can override jira-quick-edit-plugin. If you don't - I have bad news for you https://jira.atlassian.com/browse/JRA-7990 . So, you can hope they will make it after some years $)

Hi All,

 

I am trying to implement script validation for JIRA v 7.8.2

 

We have created specific Sub tasks ad need to restrict creation of sub tasks only under specific 

Say sub task is SUBTASK A   and task is TASK ONE

i have defined Workflow for SUBTASK A and am trying to implement Validator during creation.

my syntax is 

 

["TASK ONE"].contains(issue.parentObject?.issueType.name)

 

I am getting required error message even when I am trying to create Sub task  under TASK ONE.

Please suggest what could be wrong as I think the TASK ONE name is not getting validated.

Hi @Ben De Pauw and @Mark McComark,

Above scripts are not working in my Jira(7.12.3 version) could you help me on this please.

Thanks in Advance,

Manikanta

Hi @mani, could you please create a ticket on our Product Support Portal and include the script(s) that is no longer working as well as details on the version of Jira you upgraded from (and to Jira 7.12.3).

Also, please include any relevant log(s) or errors (if any).

Thanks in advance, Mark.

@Mark McCormack @Mani  I have worked out on the script and made it work for our JIRA

 

Please use this in Validator  for create transition in the workflow.

 

issue.parentObject?.issueType.name in ["XXXXX']

where XXXXX is the name of your parent issue type.

 

please make sure that there are no spaces in the name before and after the alphabets.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in United States

Great user group meeting!

Thanks to the host, FlightAware, and the presentors, Ben and Joe (LucidChart).  Great meeting other people who use and like the Atlassian product set!

33 views 3 2
View post

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