YouTrack Standalone 2021.2 Help

Dependencies

This workflow prevents setting an issue state to Fixed if it has dependent issues that are not resolved.

Name@jetbrains/youtrack-workflow-dependencies
Auto-attachedno
ModulesBlock users from resolving issues with unresolved dependencies (on-change rule)

Use Case

If a user tries to fix an issue that depends on another issue that is not resolved, a warning is displayed. The issue state cannot be set to Fixed.

Modules

When the issue state is set to Fixed, the on-change rule in this module checks the list of linked issues for depends on -links.
If there are any linked issues in the depends on list, the rule checks the current state of each linked issue.

  • If all of the linked issues are resolved, proceed and resolve the current issue.

  • If any of the linked issues are not resolved, a warning is displayed. The transition to the Fixed state for the original issue is cancelled.

Block users from resolving issues with unresolved dependencies

const entities = require('@jetbrains/youtrack-scripting-api/entities'); const workflow = require('@jetbrains/youtrack-scripting-api/workflow'); exports.rule = entities.Issue.onChange({ title: 'Block users from resolving issues with unresolved dependencies', guard: (ctx) => { return ctx.issue.fields.becomes(ctx.State, ctx.State.Fixed) && ctx.issue.links['depends on'].isNotEmpty(); }, action: (ctx) => { ctx.issue.links['depends on'].forEach(function(dep) { if (!dep.project.isArchived && dep.isReported) { workflow.check(dep.isResolved, workflow.i18n('The issue has unresolved dependencies and thus cannot be set Fixed! (depends on {0})', dep.id)); } }); }, requirements: { State: { type: entities.State.fieldType, Fixed: {} }, Depend: { type: entities.IssueLinkPrototype, outward: 'is required for', inward: 'depends on' } } });

Last modified: 08 March 2021