YouTrack Standalone 2021.2 Help

Kanban

This workflow manages the Kanban state of an issue when it is moved from one stage to the next.

Name@jetbrains/youtrack-workflow-kanban
Auto-attachedno
ModulesBlock change in Kanban stage for issues that are not ready to pull (on-change rule)

Use Case

This workflow helps you manage the Kanban state of an issue.

Modules

When a reported issue is moved from one stage to the next, the on-change rule in this module checks the value in the Kanban State field. If the Kanban State is not set to Ready to pull, a warning is displayed. The change is reverted.

If the Kanban State is set to Ready to pull, the Kanban State is set to Blocked when the issue is moved to the next stage.

Block change in Kanban stage for issues that are not ready to pull

const entities = require('@jetbrains/youtrack-scripting-api/entities'); const workflow = require('@jetbrains/youtrack-scripting-api/workflow'); exports.rule = entities.Issue.onChange({ title: 'Block change in Kanban stage for issues that are not ready to pull', guard: (ctx) => { const issue = ctx.issue; return issue.isReported && issue.fields.isChanged(ctx.Stage); }, action: (ctx) => { const issue = ctx.issue; workflow.check(issue.fields.is(ctx.KanbanState, ctx.KanbanState.ReadyToPull), workflow.i18n('The issue is not ready to be pulled')); issue.fields.KanbanState = ctx.KanbanState.Blocked; }, requirements: { Stage: { type: entities.State.fieldType }, KanbanState: { name: 'Kanban State', type: entities.EnumField.fieldType, ReadyToPull: { name: 'Ready to pull' }, Blocked: {} } } });

Assign on move

This on-change module assigns the issue to the current user when the issue is moved, that is the Stage field is changed.

const entities = require('@jetbrains/youtrack-scripting-api/entities'); exports.rule = entities.Issue.onChange({ title: 'Assign on move', guard: (ctx) => { const issue = ctx.issue; return issue.isReported && !issue.fields.Assignee && issue.fields.isChanged(ctx.Stage); }, action: (ctx) => { const issue = ctx.issue; if (issue.project.findFieldByName(ctx.Assignee.name).findValueByLogin(ctx.currentUser.login)) { issue.fields.Assignee = ctx.currentUser; } }, requirements: { Assignee: { type: entities.User.fieldType }, Stage: { type: entities.State.fieldType } } });
Last modified: 08 March 2021