YouTrack Server 2024.3 Help

Enhance Helpdesk Support

A popular practice with helpdesk projects is to assign new tickets based on a round-robin scheme. This balances the workload between members of the support team. The idea is simple — whenever a new ticket appears, it is assigned to the team member who is assigned the fewest New and Open tickets.

The implementation is straight-forward. When a new ticket is created, the workflow rule checks the workload of each support engineer. The member of the team with the fewest tickets is selected as the assignee.

const entities = require('@jetbrains/youtrack-scripting-api/entities'); const search = require('@jetbrains/youtrack-scripting-api/search'); exports.rule = entities.Issue.onChange({ title: 'Set Assignee automatically via Round Robin scheme', guard: (ctx) => { const issue = ctx.issue; return issue.becomesReported && !issue.fields.Assignee; }, action: (ctx) => { const assignees = ctx.Assignee.values; const numbers = {}; assignees.forEach(function (assignee) { numbers[assignee.login] = 0; }); const issues = search.search(ctx.issue.project, '#unresolved has: Assignee'); issues.forEach(function (issue) { numbers[issue.fields.Assignee.login] += 1; }); let min = Number.MAX_VALUE; let user = null; assignees.forEach(function (assignee) { if (numbers[assignee.login] < min) { min = numbers[assignee.login]; user = assignee; } }); ctx.issue.fields.Assignee = user; }, requirements: { Assignee: { type: entities.User.fieldType } } });

You can use this scheme not just for a helpdesk, but also for any process where you want to balance the workload. Also, the rules for balancing new assignments can be much more complex. For example, you can assign higher weights to overdue tickets.

Last modified: 12 June 2024