Forums

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

Sprint Start Listener Event doesn't contain Sprint

JT August 30, 2018

Hi,

I was testing a custom listener in Script Runner and I used some code that I found :

https://scriptrunner.adaptavist.com/latest/jira/listeners.html

(in the JIRA Software Events section)

 

Here it is :

import com.atlassian.greenhopper.service.rapid.view.RapidViewService import com.atlassian.greenhopper.service.sprint.Sprint import com.atlassian.greenhopper.web.rapid.chart.HistoricSprintDataFactory import com.atlassian.jira.component.ComponentAccessor import com.onresolve.scriptrunner.runner.customisers.PluginModuleCompilationCustomiser import com.onresolve.scriptrunner.runner.customisers.WithPlugin @WithPlugin("com.pyxis.greenhopper.jira") def historicSprintDataFactory = PluginModuleCompilationCustomiser.getGreenHopperBean(HistoricSprintDataFactory) def rapidViewService = PluginModuleCompilationCustomiser.getGreenHopperBean(RapidViewService) def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser() def sprint = event.sprint as Sprint if (sprint.state == Sprint.State.CLOSED) { def view = rapidViewService.getRapidView(user, sprint.rapidViewId).value def sprintContents = historicSprintDataFactory.getSprintOriginalContents(user, view, sprint) def sprintData = sprintContents.value if (sprintData) { def incompleteIssues = sprintData.contents.issuesNotCompletedInCurrentSprint*.issueId log.warn "incompelte issues id : ${incompleteIssues}" } }

 

And leaving the code exactly like in the documentation, I get the following error :

Untitled.png

Does anyone know how to solve this issue?

 

Thanks

2 answers

1 accepted

0 votes
Answer accepted
JT August 30, 2018

Running the script works even if there is an error in edit mode.

0 votes
nick.rozhdestvensky
Contributor
February 21, 2019

@JT try this:

def event = event as com.atlassian.greenhopper.api.events.sprint.SprintEvent
def sprint = event.sprint as Sprint

Suggest an answer

Log in or Sign up to answer