Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Help with Listener on SprintStartedEvent- Copy Custom Field Value to Assignee

I am trying to create a Custom Listener that fires on the SprintStartedEvent. 

What I want for the outcome is when a Sprint is started the value that is in the custom field "Planned Assignee" which is a single user picker field will be copied into the Assignee field. 


I am not sure how to get this started. I haven't been able to find any previous questions asked that are helpful in this situation. 


2 answers

Thanks for links to the documentation. It has not proved to be terribly helpful. 

This is the script that I have cobbled together looking at various examples of things that are sorta close. 


You can see that the event.issue is causing a problem and that is what the log references: 

2022-05-05 10:50:35,729 ERROR [runner.AbstractScriptListener]: *************************************************************************************
2022-05-05 10:50:35,729 ERROR [runner.AbstractScriptListener]: Script function failed on event:, file: null
groovy.lang.MissingPropertyException: No such property: issue for class:

I am not sure how to get around that.  I can't even start to see how the rest of the code is messed up while that is erroring.  

I see I did not mention this in the OP, I am using Jira Data Center 8.20.1. Looks like ScriptRunner is on 6.49. 

Craig Nodwell Community Leader May 05, 2022

Yes the event is a sprint event and not an issue event.  You need to get the issues out of the sprint event as per the example in the Library (although that's for the closed event the logic is basically the same). 
So this line here the value would be null.  def issue = event.issue as issue

So in the example, everything above line 21 if (sprintData) is somehow grabbing the issues from the Sprint. Okay. I still don't understand at all how I would call the custom field "Planned Assignee" and use that to populate the Assignee field because the only way I know how to do that is using script with issue in it (issue.assignee, event.issue, etc). 

If the example is somehow showing that then I do not understand how. 



I'm really sorry I can't test for you but you need to try something along these lines.

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
import com.atlassian.jira.workflow.TransitionOptions

def historicSprintDataFactory = PluginModuleCompilationCustomiser.getGreenHopperBean(HistoricSprintDataFactory)
def rapidViewService = PluginModuleCompilationCustomiser.getGreenHopperBean(RapidViewService)

def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()
def sprint = event.sprint as Sprint
def sprintState = sprint.state

if (sprintState == Sprint.State.ACTIVE) {
def view = rapidViewService.getRapidView(user, sprint.rapidViewId).value
def sprintContents = historicSprintDataFactory.getSprintOriginalContents(user, view, sprint)
def sprintData = sprintContents.value
def issueService = ComponentAccessor.getIssueService()


if (sprintData) {
def issues = sprintData.contents.issuesNotCompletedInCurrentSprint

issues.each { issue ->

def issueId =

def sourceField = customFieldManager.getCustomFieldObjectByName("Planned Assignee")

// put the rest of your code here



0 votes
Craig Nodwell Community Leader May 03, 2022

Hi @Chelsea welcome to the community.
I'd suggest you start here, there's lots of examples.

Jira Server:

  1. Scriptrunner What are Listeners 
  2. In the custom scripts there's an example with the sprintclosed event you can review.
    Scriptrunner Custom listeners 
  3. Another great resource is the Script Library
    Scriptrunner Library 

Jira Cloud:

  1. Scriptrunner Listeners 
  2. Scriptrunner listener examples 
  3. Scriptrunner Library Cloud 
  4. Code Snippets Repository 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

338 views 2 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you