YouTrack Standalone 2018.2 Help

Issue Property Combinations

This workflow blocks users from setting specific combinations of values for fields in an issue. You can customize this workflow to prevent any combination of values you want to avoid.

Name

@jetbrains/youtrack-workflow-issue-properties-combinations

Previous Title

Issue Properties Combinations

Auto-attached

no

Modules

Block incompatible value combinations for custom fields (on-change rule)

Use Case

This workflow helps to make sure that users do not create combinations of priorities and states that you want to avoid in your project.

Module

This on-change rule checks the combination of Priority and State when an issue is created or updated. The following combinations are blocked:

  • Submitted and Show-stopper

  • Open and Unassigned

Block incompatible value combinations for custom fields

var entities = require('@jetbrains/youtrack-scripting-api/entities'); var workflow = require('@jetbrains/youtrack-scripting-api/workflow'); exports.rule = entities.Issue.onChange({ title: workflow.i18n('Block incompatible value combinations for custom fields'), action: function(ctx) { var issue = ctx.issue; workflow.check(!(issue.fields.Priority.name === ctx.Priority.ShowStopper.name && issue.fields.State.name === ctx.State.Submitted.name), workflow.i18n('Denied fields combination detected (Submitted Show-stopper)')); workflow.check(!(issue.fields.Assignee === null && issue.fields.State.name === ctx.State.Open.name), workflow.i18n('Denied fields combination detected (Open Unassigned)')); }, requirements: { Priority: { type: entities.EnumField.fieldType, ShowStopper: { name: 'Show-stopper' } }, State: { type: entities.State.fieldType, Submitted: {}, Open: {} }, Assignee: { type: entities.User.fieldType } } });
Last modified: 7 March 2019