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,
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.ComponentAccessorimport com.atlassian.greenhopper.service.sprint.Sprintdef cfSprint = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Sprint")def currentSprint = issue.getCustomFieldValue(cfSprint) as Listdef sp = currentSprint?.last() as Sprintdef 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
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!
Kris
@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 Stringif(epic){ def epicIssue = issueManager.getIssueObject(epic)}
Let me know if you need assistance still
Thank you very much! It works.
It looks like you're new here. Sign in or register to get started.