Restrict sub-tasks based on Issue Type

Required apps

Power Scripts™ for Jira (server)

Level: BASIC

Problem

We want to restrict the sub-tasks according to the issue types. For example, if issue type is New Feature or Improvement, we want to remove from the list of available sub-tasks the following one: Sub-task (we'll allow only other types of subtasks, never the standard one)

Solution

By using lfRestrictSelectOptions SIL™ routine we'll easily manage to hide some sub-task issue types for certain projects. All you have to do is to create the following script and associate it with the main Live Fields configuration on your project, as described on the Live Fields page.

restrict_subtask.sil
//Note: you may need to check for the screen (or put the conditions we run over with)
if(argv["screen"] == "create-subtask") { //only on that screen
  string[] issueTypes = {"New Feature", "Improvement"}; //the array of the Issue Types 
  string[] subTasks = {"Sub-task"}; //the array of the Sub-Tasks to restrict
  if(elementExists(issueTypes, issueType)) {
      lfRestrictSelectOptions("issueType", subTasks);
  }
} 


That's it.

See also