YouTrack Standalone 2021.1 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 TitleIssue Properties Combinations
Auto-attachedno
ModulesBlock 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

const entities = require('@jetbrains/youtrack-scripting-api/entities'); const workflow = require('@jetbrains/youtrack-scripting-api/workflow'); exports.rule = entities.Issue.onChange({ title: 'Block incompatible value combinations for custom fields', action: (ctx) => { const issueFields = ctx.issue.fields; workflow.check(!(issueFields.is(ctx.Priority, ctx.Priority.ShowStopper) && issueFields.is(ctx.State, ctx.State.Submitted)), workflow.i18n('Denied fields combination detected (Submitted Show-stopper)')); workflow.check(!(!issueFields.Assignee && issueFields.is(ctx.State, ctx.State.Open)), 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: 08 March 2021