Hi Everyone,
As title, How do I get the sprint start date using Behaviours? Is it possible? Thank you very much!
Best Regards,
Kris
Hi,
Below code might help. But, bear in mind that an issue can have multiple sprint values, and this script returns the date of first sprint.
Sorry that I was not able to test the code, but it would guide you to a running version ;)
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def sprintCf = customFieldManager.getCustomFieldObject(10000) // id of Sprint customfield
return issue.getCustomFieldValue(sprintCf)?.startDate?.first()?.toDate()
Hi,
Thanks for your answer. However, It showed an error which is "issue is not undeclared". How should I fix this error? Thank you very much!
Best Regards,
Kris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Even I changed it to underlyingIssue, it will also show there is no property for startdate. Please help me on it. Really appreciate!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kris,
Ignore that error and try to run the code.
Groovy is a dynamic scripting language in which you can code without defining static types.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Happy to help :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tuncay Senturk ,
Sorry to bother you again,
Do you know how to get sprint start date using script field? Thank you very much!
Best Regards,
Kris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No worries!
It should be the same way actually
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tuncay Senturk ,
Sorry to bother you again,
Is there any way which can fill up the value I caught from the script automatically without any transition? Thank you very much!
Best Regards,
Kris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kris Han
No worries, you're not bothering at all.
You can use the same code in anywhere (scripted custom field, scripted post function, behaviors, even in listeners).
For instance you can implement your own scripted listener in which you can listen to any issue change and pick Sprint start date and do whatever you want. Only one or two lines might be added to your script accordingly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tuncay Senturk ,
I copied the entire script to Listener but I got lot of errors. Could you help me to give me some example? Thank you very much!
Best Regards,
Kris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to provide more info regarding your demand.
But you can use below code to start
import com.atlassian.jira.component.ComponentAccessor
def issue = event.issue
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def sprintCf = customFieldManager.getCustomFieldObject(10000) // id of Sprint customfield
def sprintStartDate = issue.getCustomFieldValue(sprintCf)?.startDate?.first()?.toDate()
// then use this sprintStartDate on whatever you want to do.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Today only! Share what you’re the most excited about for Team ‘25 or just dance out the beginning of a new quarter with us.
Comment the postOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.