Subtask Inherit Fix Versions
This workflow automatically updates the fix version of a subtask to the fix version set for a parent task.
File Name | jetbrains-youtrack-subtaskInheritFixVersions |
---|---|
Auto-attached | yes |
Rules | Set parent 'Fix versions' to added unresolved subtasks (stateless) Set added parent 'Fix versions' to unresolved subtasks (stateless) |
Use Case
This workflow helps you manage the fix version set for tasks and subtasks.
This workflow updates the values that are stored in the Fix versions custom field. To use this workflow, you need to make sure this field is used in the projects that you want to update. The option to store multiple values in the Fix versions field must be enabled in all of the projects that use this workflow.
Rules
This workflow includes two rules.
Set parent 'Fix versions' to added unresolved 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 Fix versions field, the fix versions are set for the parent task only.
- If the subtask and parent task belong to the same project, the fix versions assigned to the parent task are set as the fix versions for any unresolved subtasks.
rule Set parent 'Fix versions' to added unresolved subtasks
when parent for.added.isNotEmpty {
for each subtask in parent for.added {
if (project != subtask.project && issue.project.valuesFor(Fix versions).first != subtask.project.valuesFor(Fix versions).first) {
continue;
}
if (!subtask.isResolved()) {
subtask.Fix versions.clear;
for each version in Fix versions {
subtask.Fix versions.add(version);
}
}
}
}
Set added parent 'Fix versions' to unresolved subtasks
The next rule checks for subtasks when the fix versions are 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 Fix versions field, the fix versions are set for the parent task only.
- If the subtasks are in an active project and belong to the same project as the parent task, the fix versions for each unresolved subtask are set to the fix versions that are set for the parent task.
rule Set added parent 'Fix versions' to unresolved subtasks
when Fix versions.added.isNotEmpty {
for each subtask in parent for {
if (subtask.project.isArchived() || project != subtask.project && issue.project.valuesFor(Fix versions).first != subtask.project.valuesFor(Fix versions).first) {
continue;
}
if (!subtask.isResolved()) {
subtask.Fix versions.clear;
for each version in Fix versions.added {
subtask.Fix versions.add(version);
}
}
}
}
Last modified: 18 April 2017