YouTrack Standalone 2020.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-attached

no

Modules

Require 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

var entities = require('@jetbrains/youtrack-scripting-api/entities'); var workflow = require('@jetbrains/youtrack-scripting-api/workflow'); exports.rule = entities.Issue.onChange({ title: workflow.i18n('Require a fix version to resolve an issue'), guard: function(ctx) { return ctx.issue.fields.becomes(ctx.State, ctx.State.Fixed); }, action: function(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: 1 July 2020