workflow.check prompt is not showing in my script
In YouTrack I have written a script, to disallow the user from removing links. Below is a sample script in my Task project workflow, where I am not allowing Task<>Meeting link to be broken. (Meeting is another project with its own workflow.)
The behavior is, you cannot remove the link (expected), but the prompt ("Cannot remove link…") is not showing (not expected).
var entities = require('@jetbrains/youtrack-scripting-api/entities');
var workflow = require('@jetbrains/youtrack-scripting-api/workflow');
exports.rule = entities.Issue.onChange({
title: 'link_removed',
guard: function(ctx) {
return ctx.issue.links['subtask of'].removed.isNotEmpty();
},
action: function(ctx) {
const remList = ctx.issue.links['subtask of'].removed;
if(remList) {
for(let r = 0; r < remList.size; r++) {
const R = remList.get(r);
workflow.check(R.project.name != 'Meetings', 'Cannot remove link. Close task instead.');
}
}
},
requirements: {
}
});
Any reason for this?
thank you!
Please sign in to leave a comment.
Hi Jbonsall,
Thank you for sharing the exact code you use!
The prompt doesn't get displayed because of a recent bug in YouTrack, so there's no issue with the code: JT-94121. There's no definitive ETA for a fix yet, but you can give the issue a thumbs-up to get subscribed to any further updates!