YouTrack Standalone 2021.2 Help

Set Fix Versions

This workflow forces developers to set the fix version when they resolve an issue.

Name@jetbrains/youtrack-workflow-set-fix-versions
Auto-attachedno
ModulesRequire a fix version to resolve an issue (on-change rule)

Use Case

This workflow was originally taken from a submitted request (JT-2468 ).

The user who submitted this issue wanted to force developers to set the fix version when they resolved an issue.

Modules

When an issue is updated, this on-change rule checks whether the state is changed to Fixed. If true, the rule requires that a value is set in the Fixed versions field.

  • If a value is set in the Fixed versions field, the issue is resolved as Fixed.

  • If the Fixed versions field is empty, a warning is displayed. The issue is not resolved. The required field is highlighted.

Require a fix version to resolve an issue

const entities = require('@jetbrains/youtrack-scripting-api/entities'); const workflow = require('@jetbrains/youtrack-scripting-api/workflow'); exports.rule = entities.Issue.onChange({ title: 'Require a fix version to resolve an issue', guard: (ctx) => { return ctx.issue.fields.becomes(ctx.State, ctx.State.Fixed); }, action: (ctx) => { ctx.issue.fields.required(ctx.FixVersions, workflow.i18n('Please set the \'Fix versions\' field!')); }, requirements: { State: { type: entities.State.fieldType, Fixed: {} }, FixVersions: { name: 'Fix versions', type: entities.ProjectVersion.fieldType, multi: true } } });

Last modified: 08 March 2021