Hello,
Is it possible to change a sprint's end date using scriptrunner?
Example:
given a sprint name, using the script console, to change the end date for that sprint from the 9th of july to the 30th of July.
What would also be good is if I could clear a sprint's start and end date via the console.
I'm mentioning that the sprint is not started, but it has an end date because of a synchronization done by BigPicture Gantt module which adds end dates to sprints.
Thank you!
You are passing "java.sqlTimestamp" instead of expected types in the method
Possible solutions: endDate(java.lang.Long), endDate(org.joda.time.DateTime),
Try something like this , there System.currentTimeMillis returns current time in long.
def newSprint = sprint.builder(sprint).endDate(System.currentTimeMillis()
).build()
Please see this thread for more details.
Thank you very much, that works!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Kindly read the following thread:
There is an idea on how to work with sprints in groovy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just to add to @Alexey Matveev's answer, you can use the sprintBuilder and use the existing sprint object but set the new endDate which you want.
Set new endDate using the builder
Use existing sprint object in the builder -
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Thank you for your replies.
Currently I have something that returns the sprint name and dates.
import com.atlassian.greenhopper.service.sprint.Sprint
import com.atlassian.greenhopper.service.sprint.SprintManager
import com.onresolve.scriptrunner.runner.customisers.PluginModuleCompilationCustomiser
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
def sprintManager = PluginModuleCompilationCustomiser.getGreenHopperBean(SprintManager)
def sprintServiceOutcome = sprintManager.getAllSprints()
if (sprintServiceOutcome.valid) {
def sprint = sprintServiceOutcome.getValue().find {it.name == "my_sprint_name"} as Sprint
return sprint
}
I do not know how to use sprintBuilder to set a certain date. Could you please help with that?
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
def sprint = sprintServiceOutcome.getValue().find {it.name == "my_sprint_name"} as Sprint
def newSprint = sprint.builder(sprint).endDate(<Your Date in long>).build()
def outcome = sprintManager.updateSprint(newSprint)
This should do it, above code doesn't include logging thus please add loggin as per the example link shared by Alexey
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tarun,
Thank you for your reply.
I tried the following:
def sprint = sprintServiceOutcome.getValue().find {it.name == "name"} as Sprint
def todaysDateTime = new Timestamp((new Date()).time)
def newSprint = sprint.builder(sprint).endDate(todaysDateTime).build()
def outcome = sprintManager.updateSprint(newSprint)
No signature of method: com.atlassian.greenhopper.service.sprint.Sprint$SprintBuilder.endDate() is applicable for argument types: (java.sql.Timestamp) values: [2018-08-06 13:57:01.931] Possible solutions: endDate(java.lang.Long), endDate(org.joda.time.DateTime), name(java.lang.String), state(com.atlassian.greenhopper.service.sprint.Sprint$State)
I also tried with
def newSprint = sprint.builder(sprint).endDate(1533556077000).build()
but it still gives the same error.
Do you also know how the correct format looks like?
Thank you very much!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.