Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

How should I get sprint end date and do the comparison with other sprint's end date

Hi all, 

As title, Is there any way which I can get sprint end date from story and do the comparison with another story's sprint end date? (prefer using Post-function or Script filed) Thank you very much!

 

Best Regards,

2 answers

2 accepted

0 votes
Answer accepted
Leo Community Leader Jan 31, 2020

Hi @Kris_Han,

In Post-function you can use below code for getting sprint's end date

you can get it's state to verify whether it's active or not

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.greenhopper.service.sprint.Sprint

def cfSprint = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Sprint")
def currentSprint = issue.getCustomFieldValue(cfSprint) as List
def sp = currentSprint?.last() as Sprint
def endDate = sp.getEndDate()

 

here issue  is current issue on which transition happened

to work on another issue's date and fields use below code to get another issue object by using it's key and once you have both issues sprint end date you can make a comparison

def anotherIssue=ComponentAccessor.getIssueManager().getIssueObject("JIRA-12")

 

Hope this gives you some idea

 

BR,

Leo

0 votes
Answer accepted

Hi @Leo ,

Thanks for your help. This script is work but can I ask one more question? How should I get the epic link's sprint end by using script? Thank you very much!

 

Best Regards,

Kris

Leo Community Leader Feb 03, 2020

@Kris_Han,

same as above script but instead of issue.{method} will have to fetch current issue's epic as issue and run sprint method as same as above script

I'll just post script to convert current issue's epic(if associated) as issue object

def issueManager = ComponentAccessor.issueManager

def epicLink = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Epic Link")

def epic = issue.getCustomFieldValue(epicLink) as String
if(epic){
def epicIssue = issueManager.getIssueObject(epic)

}

Let me know if you need assistance still

 

BR,

Leo 

Hi @Leo ,

Thank you very much! It works.

 

Kris 

Suggest an answer

Log in or Sign up to answer
TAGS

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