为 YouTrack 中的现有问题创建(子任务)link
Create a (subtask) link to an existing issue in YouTrack
我正在编写一个 Action 来为用户故事创建默认任务。这是我得到的结果:
var workflow = require('@jetbrains/youtrack-scripting-api/workflow');
var entities = require('@jetbrains/youtrack-scripting-api/entities');
exports.rule = entities.Issue.action({
title: 'Create default subtasks',
command: 'tt-create-subtasks',
guard: function(ctx) {
// Condition that must be met to enable the custom command:
return ctx.issue.fields.Type.name == "User Story";
},
action: function(ctx) {
var issue = ctx.issue;
var newIssue = ctx.issue.copy(issue.project);
newIssue.summary = 'API spoofing';
newIssue.fields.Type = ctx.Type.Task;
// var link = newIssue.links.add(issue); ????
workflow.message('Default task created under issue ' && issue.description);
},
requirements: {
Type: {
type: entities.EnumField.fieldType,
Task: {}
},
}
});
如何创建新的 link 使 newIssue
成为 issue
的子任务?
我查看了代码完成提供的内容、documentation for the Issue property、SO 问题、YouTrack 中已经存在的工作流代码,但我被卡住了...
您也应该指定问题 link。以下代码应该有效(newIssue
将是 issue
的子任务):
newIssue.links['subtask of'].add(issue);
您可以在此处找到示例:https://blog.jetbrains.com/youtrack/2017/12/make-it-workflow-part-4-generating-new-issues/
我正在编写一个 Action 来为用户故事创建默认任务。这是我得到的结果:
var workflow = require('@jetbrains/youtrack-scripting-api/workflow');
var entities = require('@jetbrains/youtrack-scripting-api/entities');
exports.rule = entities.Issue.action({
title: 'Create default subtasks',
command: 'tt-create-subtasks',
guard: function(ctx) {
// Condition that must be met to enable the custom command:
return ctx.issue.fields.Type.name == "User Story";
},
action: function(ctx) {
var issue = ctx.issue;
var newIssue = ctx.issue.copy(issue.project);
newIssue.summary = 'API spoofing';
newIssue.fields.Type = ctx.Type.Task;
// var link = newIssue.links.add(issue); ????
workflow.message('Default task created under issue ' && issue.description);
},
requirements: {
Type: {
type: entities.EnumField.fieldType,
Task: {}
},
}
});
如何创建新的 link 使 newIssue
成为 issue
的子任务?
我查看了代码完成提供的内容、documentation for the Issue property、SO 问题、YouTrack 中已经存在的工作流代码,但我被卡住了...
您也应该指定问题 link。以下代码应该有效(newIssue
将是 issue
的子任务):
newIssue.links['subtask of'].add(issue);
您可以在此处找到示例:https://blog.jetbrains.com/youtrack/2017/12/make-it-workflow-part-4-generating-new-issues/