Developer Portal for YouTrack and Hub Help

Kanban

This workflow is designed to support a pull-based system where tasks are processed as capacity becomes available, which helps optimize team productivity and efficiency. It's meant to simulate a physical Kanban board where the tasks in each column are marked as Blocked (or another value like Ongoing) and Ready to pull (or Done).

It's specifically intended for teams where a single task is processed by different specialists through a series of handoffs. For example, a creative team where work passes from research to design, review, approval, quality assurance, and publication.

Using this model, any task that transitions from one column to the next is immediately flagged as Blocked. This prevents people further down the production pipeline from pulling the task until it is marked as Ready to pull. These statuses are stored in a dedicated field called Kanban State

In our example, the designers are free to work on any task that the research department has marked as Ready to pull, but the reviewers are blocked from pulling the same task until the designer has finished their work.

Name

@jetbrains/youtrack-workflow-kanban

Auto-attached

no

Modules

Block 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), '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: 7 November 2024