依存関係が解決されたときに通知する
このワークフローは、依存する課題が解決されると、課題の担当者に通知を送信します。
名前 | @jetbrains/youtrack-workflow-notify-when-dependency-resolved |
|---|---|
自動添付 | いいえ |
モジュール | 「必須」としてリンクされた課題が解決されたときに担当者に通知する (変更時のルール) |
ユースケース
このワークフローにより、ユーザーは待機中の課題の 1 つが解決されたときに通知されます。
モジュール
このルールは、に必要に応じてリンクされている課題のステータスをチェックします。リンクされた課題が解決されると、ブロックされた課題の担当者に通知されます。
「必須」としてリンクされた課題が解決されたときに担当者に通知する
const entities = require('@jetbrains/youtrack-scripting-api/entities');
const workflow = require('@jetbrains/youtrack-scripting-api/workflow');
exports.rule = entities.Issue.onChange({
title: 'Notify assignee when an issue linked as "required for" is resolved',
guard: (ctx) => {
const issue = ctx.issue;
return issue.fields.isChanged(ctx.State) && issue.fields.State && issue.fields.State.isResolved &&
(!issue.fields.oldValue(ctx.State) || !issue.fields.oldValue(ctx.State).isResolved);
},
action: (ctx) => {
if (ctx.issue.links['is required for'].isNotEmpty()) {
const getLinkToIssue = function(i) {
return '<a href="' + i.url + '">' + i.id + '</a> ' +
'<a href="' + i.url + '">' + i.summary + '</a>';
};
ctx.issue.links['is required for'].forEach(function(dependent) {
const assignee = dependent.fields.Assignee;
const state = dependent.fields.State;
if (assignee && assignee.login !== ctx.currentUser.login && (!state || !state.isResolved)) {
const subject = '[Youtrack, Required issue is resolved]';
const body = [
'Dear assignee of {0}.', getLinkToIssue(ctx.issue),
'<br>',
'I\'m pleased to inform you that the issue required for your work - ' +
'{0} - just has been resolved.', getLinkToIssue(dependent),
'<p style="color: gray; font-size: 12px; margin-top: 1em; border-top: 1px solid #D4D5D6">',
'Sincerely yours, YouTrack',
'</p>'
].join('\n');
assignee.notify(subject, body, true);
}
});
}
},
requirements: {
State: {
type: entities.State.fieldType
},
Assignee: {
type: entities.User.fieldType
},
Depend: {
type: entities.IssueLinkPrototype,
name: 'Depend',
outward: 'is required for',
inward: 'depends on'
}
}
});
2026 年 2 月 04 日