Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to set active sprint in ScriptRunner Behaviour by default

Max Nikolsky February 9, 2018

Hello.

My task is to fill Sprint field = current active sprint by default.

I've written this code as my first behaviour script

import com.atlassian.greenhopper.service.sprint.Sprint
import com.atlassian.greenhopper.service.sprint.SprintManager
import com.onresolve.scriptrunner.runner.customisers.PluginModuleCompilationCustomiser
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.atlassian.jira.component.ComponentAccessor
import org.apache.log4j.Logger
import org.apache.log4j.Level
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder


def sprintManager = PluginModuleCompilationCustomiser.getGreenHopperBean(SprintManager)

def sprintServiceOutcome = sprintManager.getAllSprints()

def SprintField = getFieldByName("Sprint")

SprintField.setFormValue(sprintServiceOutcome.getValue()[0])


Here I'm going to get all sprints, filter them in some way (by state and rapidboard - not implemented yet) and set it to Sprint field.

But this code do not work for me. I've tried to debug and I'm sure that

sprintServiceOutcome.getValue()[0]


have not null value and fieldname is correct, so,

SprintField 

also is not null.

So I don't know how to do it using adaptavist Scriptrunner.

P.S: maybe there is a way to resolve this better. Appreciate any improvements.

1 answer

0 votes
Kyle Moseley
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 15, 2018

It looks like this is not yet supported.

https://productsupport.adaptavist.com/browse/SRJIRA-2239

Suggest an answer

Log in or Sign up to answer