Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Set default value of Sprint Field


I'll be happy to know if there is any way to set by default the Sprint field value to be the same as the current active sprint. 

I'm using ScriptRunner, Thanks in advance!

1 answer

Hi @Yuval Maron 

Yes, it is doable. You can put the following script in the Initialiser field:


import com.atlassian.greenhopper.service.rapid.view.RapidViewService
import com.atlassian.greenhopper.service.sprint.SprintIssueService
import com.atlassian.greenhopper.service.sprint.SprintManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.onresolve.scriptrunner.runner.customisers.JiraAgileBean
import com.onresolve.scriptrunner.runner.customisers.WithPlugin

* Configurable section
// Enter the board id to which you want to add the issue to the first active sprint
def rapidBoardId = 1L


RapidViewService rapidViewService

SprintIssueService sprintIssueService

SprintManager sprintManager

def loggedInUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def view = rapidViewService.getRapidView(loggedInUser, rapidBoardId).getValue()

// Sprint Field

def field = getFieldByName("Sprint")

if (!view) {
log.warn("No view with this ID found")

// get all sprints in the Rapid Board

def sprints = sprintManager.getSprintsForView(view).getValue()

// find active sprint

def activeSprint = sprints.find { }

if (activeSprint) {

// set Active Sprint ID


The configuration should be looking like this:

Screenshot 2021-05-11 at 1.17.37 PM.png

Then, save the Behaviour config with the script. Next, go to the Create Issue screen and you will see the Sprint field has set to the default active sprint. 

A recorded demo for your reference - video.mp4

Bear in mind, the script is made for Behaviour. You can reuse the script for other such as post-function or listeners. If that the case, please remove this line:

def field = getFieldByName("Sprint")


And, replace with other script to get the Sprint custom field name and set to the issue.

I hope this helps.

Hey @John Chin ,

Thank you so much for this!

Hi @Yuval Maron ,

No problem :)

Feel free to accept the answers if its working for you.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

299 views 9 7
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