Assignee from workflow search are always null
Maybe I'm missing something here, but I'm tryin to access the Assignee field after doing a workflow search. Code is below. I am able retrieve the correct number of issues and I can access custom fields via issue.fields["My Custom Field"]. I'm just not able to get the Assignee.
----------------------------
const entities = require('@jetbrains/youtrack-scripting-api/entities');
var search = require('@jetbrains/youtrack-scripting-api/search');
exports.rule = entities.Issue.action({
title: 'test3',
userInput: null,
command: 'test3',
guard: (ctx) => {
return true;
},
action: (ctx) => {
var query = 'Assignee:{All Users}';
var inProgress = search.search(null, query);
if (inProgress.isNotEmpty())
inProgress.forEach(function(issue) {
if (issue.fields.Assginee == null) {
console.log([issue.id, "IS NULL"])
} else {
console.log([issue.id, "IS NOT NULL"])
}
});
},
requirements: {
Assignee: {
type: entities.User.fieldType,
name: 'Assignee'
}
}
});
Please sign in to leave a comment.
I'm Lena from the YouTrack Team. Could you please specify if the Assignee field accepts single or multiple values?
The Assignee field is a single value. When I do a console.log it has the value of "{}" and passes the == null comparison.
Hi Rick. I noticed a typo on one of the lines: issue.fields.Assginee == null (should be Assignee). Fixing the typo should help, so I suggest trying that.
Stanislav Dubin A big thank you. That's rather embarrassing. I swore I used auto-complete, but guess not.