Event on sprint creation

Hi,

I'm trying to automatically create a set of default tasks when a new sprint is created on one of our agile boards. Sadly i can't find an option to address the event of a new sprint.

Is there any workflow event to check for changes in the project or some other way to get my desired workflow done?

 

 

0
3 comments
Official comment

Hello,

I am afraid, the workflow cannot detect adding new sprints. So, if you create sprints on a schedule, you can create the On-schedule rule that will create issues with the same schedule. Alternatively, I can suggest you create a custom Action rule to force creating required issues by clicking to that action.

I hope it will be helpful. Should you have any further questions, feel free to contact us.

Hello,

thanks for the input. I considered the mentioned solutions before as well, but they aren't as automated or failproof(start of a sprint might change) as needed.

Instead of creating the default tickets when a sprint is being created i create the tickets now when the first ticket is being added to the sprint.

That works, but has a slight performance issue as i have to iterate over all tickets of the project to check if a user defined field with the sprint names is set to the name of that sprint. This takes several seconds.

If you know of a a more elegant way to solve that problem i would appreciate that. The guard function looks like this now:

exports.rule = entities.Issue.onChange({
title: workflow.i18n('Create default tickets when the first ticket is added to a sprint'),
guard: function(ctx) {
var count = 0;
var newSprintName = "Unsheduled";
if(ctx.issue.oldValue('Sprints (MT)') == null && ctx.issue.fields['Sprints (MT)'] != null){
newSprintName = ctx.issue.fields['Sprints (MT)'].presentation;
var iter = ctx.issue.project.issues.entries();
var issue = iter.next();
while(!issue.done) {
if((issue.value.fields['Sprints (MT)']) != null) {
if(issue.value.fields['Sprints (MT)'].presentation == newSprintName){
count += 1;
}
}
issue = iter.next();
}
}
return ctx.issue.fields.isChanged('Sprints (MT)') && count == 1 && newSprintName != "Unsheduled";

},

0

Hello,

Thank you for the provided details. Since your sprint name is stored in the custom field, you can use the search method for getting all required issues:

var search = require('@jetbrains/youtrack-scripting-api/search');
...
var query = 'Sprints (MT): {' + ctx.issue.fields['Sprints (MT)'].presentation + '}';
var inProgress = search.search(issue.project, query, ctx.currentUser);
if (inProgress.isNotEmpty()) {
  // Do smth with a found set of issues.
}
I hope this helps. 
0

Please sign in to leave a comment.