Subsystem Assignee
This workflow automatically assigns an issue to a specific user based on the value set in the Subsystem field.
Name | @jetbrains/youtrack-workflow-subsystem-assignee |
---|---|
Auto-attached | yes |
Modules | Set subsystem owner as assignee for new issues (on-change rule) |
Use Case
This workflow lets you assign issues to specific developers who are responsible for working on a subsystem in a project. You can customize this rule to create other techniques for assigning issues automatically based on values in other fields.
Modules
When an issue is updated, this rule checks for the following conditions:
The Assignee field is empty.
The issue becomes reported in this transaction or the subsystem or project is changed in a reported issue.
If either of these conditions is true and the Subsystem field is not empty, the issue is assigned to the owner of the subsystem.
Set subsystem owner as assignee for new issues
var entities = require('@jetbrains/youtrack-scripting-api/entities');
var workflow = require('@jetbrains/youtrack-scripting-api/workflow');
exports.rule = entities.Issue.onChange({
title: workflow.i18n('Set subsystem owner as assignee for unassigned issues'),
guard: function(ctx) {
return !ctx.issue.fields.Assignee && ctx.issue.fields.Subsystem;
},
action: function(ctx) {
var issue = ctx.issue;
if ((issue.isReported && (issue.fields.isChanged(ctx.Subsystem) || issue.isChanged('project'))) || issue.becomesReported) {
issue.fields.Assignee = issue.fields.Subsystem.owner;
}
},
requirements: {
Assignee: {
type: entities.User.fieldType
},
Subsystem: {
type: entities.OwnedField.fieldType
}
}
});