Subtask inherit Project, Sprints

Hello,

I don't if what I want is possible, but I would like to create a workflow for when I create a subtask, this one inherits Project and Sprint from its parent. I would like to do it with the new online workflow javascript editor.

Any suggestion ?

Thanks in advance

0
7 comments

Hello Antoine, you can certainly do that using our JS workflows, please go ahead and let us know if you face any issues.

Here you can find a quick start guide: https://www.jetbrains.com/help/youtrack/incloud/2017.2/Quick-Start-Guide-Workflows-JS.html

0
Avatar
Permanently deleted user

Hello Liubov,

I already had a look at the quick start guide but I didn't find a way of doing what I want. What is the event handler for issue creation, because I need to attach my workflow on that event. And How do you know if it's a subtask or not ?

Thanks a lot

0

Hi, Antoine!

1) Use the Issue properties: https://www.jetbrains.com/help/youtrack/incloud/2017.2/v1-Issue.html#d186518e111 If you'd like your workflow to be triggered while you're creating an issue, use `!isReported`. If you'd like to trigger it right after creation, use `becomesReported`.

2) Check the issue `links` property to know whether it's a subtask or not.

0
Avatar
Permanently deleted user

Hello,

Thanks a lot I almost came to what I want. I am know able to inherit State and Sprints from parent task, but I still can't manage to inherit project, can you give me a hint on that ?

Thanks in advance

0

Could you probably share your code with me?

Thanks.

0
Avatar
Permanently deleted user

Yeah of course,

 

var entities = require('@jetbrains/youtrack-scripting-api/entities');

exports.rule = entities.Issue.onChange({
title: 'Subtask inherit parent',
action: function(ctx) {
var issue = ctx.issue;

if (!issue.isReported) {
if (issue.links['subtask of'].isNotEmpty()) {
var parent = issue.links['subtask of'].first();

issue.Project = parent.Project;
issue.fields.Type = "Task";
issue.fields.State = parent.fields.State;
}
}
},
requirements: {
// TODO: add requirements
}
});



Thanks
0

Hello Antoine, I'm sorry for the delay.

1) Please note that `.project` property name starts with a lower-case letter: `issue.project = parent.project;`

2) You need to fill the `requirements section` and write there required fields and values: https://www.jetbrains.com/help/youtrack/incloud/2017.3/requirements.html

0

Please sign in to leave a comment.