You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi Team,
I want to hide the other(Not related) sub-task while creating the sub-task.
Eg:
I have two Main task issue types & the sub task issue types.
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.