[BUG] The 'required' function does not work properly on Agile Board
Hello,
I have a simple script:
const entities = require('@jetbrains/youtrack-scripting-api/entities');
exports.rule = entities.Issue.onChange({
title: 'QA check',
guard: (ctx) => {
return ctx.issue.fields.becomes(ctx.State, ctx.State.QA);
},
action: (ctx) => {
ctx.issue.fields.required(ctx.QAby, 'Please set QA by!');
},
requirements: {
QAby: {
type: entities.User.fieldType,
name: 'QA by'
},
State: {
name: "State",
type: entities.State.fieldType,
QA: {
name: "QA"
},
},
}
});
When the State
changes from "Ready for QA
" to "QA
", this script should ask the Assignee to specify a user for QA by
field.
It works fine when I change the state from the task field (1):

If I move a task on the Agile Board, the word "State
" somehow disappears and the “Apply Command” window tries to change "Type
" instead of "State
" (2):

If I change the transition name from QA
to QA start
this happens (3):

It "fixes" the problem, shows "Send action QA start" instead of "Set Type QA", but it's the wrong behavior anyway.
Is this a bug or am I doing something wrong?
Thank you.
Please sign in to leave a comment.
Hi Viacheslav. This looks like it could be a bug, but I haven't been able to reproduce it with your workflow code.
When does the problem appear: is it when moving tasks from the backlog to the board or when they are already on the board? Does the same issue happen if you create a basic agile board from scratch with just one project selected (the one where you have this workflow attached)? I'd like to understand if there is a pattern here.
Hello,
this happens when I drag a task on the board, when the
State
changes from "Ready for QA
" to "QA
" and the rule is triggered.Hm, doesn't reproduce for me. What YouTrack version are you using, Server or Cloud? If you are using YouTrack Server, please make sure to upgrade to the latest version and try the same steps again to check if the issue remains.
Build: 20008
How to reproduce:
- create a new project;
- detach all workflows and create a test workflow;
- "fix" workflow by adding necessary states;
- create a new Kanban board and add the same states as columns (see screenshot), select “Automatically add new issues”;
- create task and drag it on the board from column to column.
And compare how the modal windows look when you drag a task on the board and when you select State in the task itself.
Second file for the test workflow:
Now it's clear; the issue does reproduce under these particular conditions. This seems to happen because Type is auto-suggested higher than State. In any case, the command should include the field name to avoid ambiguity, so I've filed this as a bug: JT-78159. Thank you!