Require attachements for new issue Bsoos Created December 30, 2021 12:10 Hi there, Is there a way to require a file attachment when a new issue is created ? Thank you
Hello Bsoos !
Yes, it is possible to do this using the workflows. Here is a simple workflow that requires all new issues to have an attachment:
const entities = require('@jetbrains/youtrack-scripting-api/entities');
const workflow = require('@jetbrains/youtrack-scripting-api/workflow');
exports.rule = entities.Issue.onChange({
title: 'Check for attachments',
guard: (ctx) => {
return ctx.issue.becomesReported && ctx.issue.attachments.isEmpty();
},
action: (ctx) => {
const issue = ctx.issue;
workflow.check(false, 'Please add the attachment!');
}
}
);
Thank you !