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

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

Avatar

1 badge earned

Collect

Participate in fun challenges

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

Challenges
Coins

Gift kudos to your peers

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

Recognition
Ribbon

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!

Leaderboard

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
4,463,496
Community Members
 
Community Events
176
Community Groups

Hide Sub-tasks Issue type

Hi Team, 

I want to hide the other(Not related) sub-task while creating the sub-task. 

Eg: Subtask.jpg

I have two Main task issue types & the sub task issue types.

  • Task
    • Sub-task 
  • Documentation 
    • Sub-Documentation 

If I want to create a sub issue for Documentation I don't want to see the Sub-task issue type, Same for Task. 

Is there any possibilities to do with Script Runner/other options? 

 

Thanks, 

Prabakaran. 

1 answer

2 votes

Hi @Prabakaran P ,

you can implement that using ScriptRunner - Behaviour (https://docs.adaptavist.com/sr4js/latest/features/behaviours).

 

Map the following behaviour to all issue types within your project and try this code into the initializer :

 

import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.component.ComponentAccessor;

IssueManager issueManager = ComponentAccessor.getIssueManager();
def parent = getFieldById("parentIssueId");
String issueType = issueContext.issueType.name;

//SUBTASK MANAGEMENT
if(parent!=null) {

  Long parentIssueId = parent.getFormValue() as Long;
  Issue parentIssue = issueManager.getIssueObject(parentIssueId);
  if(parentIssue!=null){
    String parentIssueType = parentIssue.getIssueType().getName();
    def allIssueTypes = ComponentAccessor.constantsManager.allIssueTypeObjects;
    def availableIssueTypes = [];
    if(parentIssueType.equalsIgnoreCase("Task")) {
      availableIssueTypes.addAll(allIssueTypes.findAll { it.name in ["Sub-task"] });
    } else {
      availableIssueTypes.addAll(allIssueTypes.findAll { it.name in ["Sub-Documentation"] });
    }
    def issueTypeField = getFieldById(com.atlassian.jira.issue.IssueFieldConstants.ISSUE_TYPE);
    issueTypeField.setFieldOptions(availableIssueTypes);
  }

}


Hope this helps,

Fabio

Thanks @Fabio Racobaldo _Herzum_ - this works well!

Upvoted! :) 

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events