Subtask Inherit Subsystem
This workflow automatically updates the subsystem of a subtask to the subsystem set for a parent task.
File Name | jetbrains-youtrack-subtaskInheritSubsystem |
---|---|
Auto-attached | no |
Rules | Inherit parent subsystem into subtasks (stateless) Update subtasks Subsystem on parent Subsystem changing (stateless) |
Use Case
This workflow helps you manage the subsystem set for tasks and subtasks.
Rules
This workflow includes two rules.
Inherit parent subsystem into subtasks
This rule checks a subtask when it is linked to a parent task.
- If the subtask belongs to a different project from the parent task and the projects use different sets of values for the Subsystem field, the subsystem is set for the parent task only.
- If the subtask and parent task belong to the same project, the subsystem assigned to the parent task is set as the subsystem for any unresolved subtasks.
rule Inherit parent subsystem into subtasks
when parent for.added.isNotEmpty {
for each subtask in parent for.added {
if (project != subtask.project && issue.project.valuesFor(Subsystem).first != subtask.project.valuesFor(Subsystem).first) {
continue;
}
if (subtask.Subsystem == null || subtask.Subsystem.name.eq("No subsystem", opts)) {
subtask.Subsystem = Subsystem;
}
}
}
Update subtasks Subsystem on parent Subsystem changing
The next rule checks for subtasks when a subsystem is set for an issue.
- If the subtasks are in an archived project or belong to a different project from the parent issue and the projects use different sets of values for the Subsystem field, the subsystem is set for the parent task only.
- If the subtasks are in an active project and belong to the same project as the paren task, the subsystem for each unresolved subtask is set to the subsystem set for the parent task.
rule Update subtasks Subsystem on parent Subsystem changing
when Subsystem.changed {
for each subtask in parent for {
if (subtask.project.isArchived() || project != subtask.project && issue.project.valuesFor(Subsystem).first != subtask.project.valuesFor(Subsystem).first) {
continue;
}
if (subtask.Subsystem == Subsystem.oldValue) {
subtask.Subsystem = Subsystem;
}
}
}
Last modified: 2 February 2017