The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Get latest sprint name from Epic stories

Samuel
Contributor
November 6, 2019

Hi,

Using groovy or scriptrunner, I want to get the latest sprint name that has longest timeline or close at last.

Lets say, EPIC-1 stories are distributed in 3 sprints with different end date.

Epic 1:

-sprint 1 - Timeline: 10-28-2019 to 11-15-2019

--- Story1

--- Story2

-Sprint 2 - TImeline:  11-04-2019 to 11-12-2019

--- Story1

--- Story2

-Sprint 3 - TImeline:  11-04-2019 to 11-29-2019

--- Story1

--- Story2

The script should return "Sprint 3" name. I able to find the sprint name and date value for each sprint but i not sure how to compare date for each sprint and get the latest sprint date.


Thanks,

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Raju Mandapaka
Contributor
February 18, 2021

Hi @Samuel 

Is that code worked???

0 votes
PD Sheehan
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 Champions.
November 7, 2019

Assuming your sprints are in an array, you could just sort them.

def lastSprindByEndDate = sprints.sort{it.endDate}.last()
def lastSprintName = lastSprintByEndDate.name
def lastEndDate = lastSprintByEndDate.endDate
Raju Mandapaka
Contributor
February 25, 2021

Hi @PD Sheehan ,

 

Where to run this script and what kind of script is this, we need to purchase any extra plugins for running these scripts??

Could you please let me know.

 

Thanks,

Raju

PD Sheehan
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 Champions.
February 25, 2021

If you look in the tags for this question is it includes scriptrunner and script-listener.

So this means that you need the ScriptRunner for Jira Server add-on and this is configured within that application using a custom script listener.

If you don't know what that means, I would suggest you start with https://docs.adaptavist.com/sr4js/latest/get-started