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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.