Hi Daniel!
It's going to be challenging: sprints are associated with boards, not projects. That being said, a board can be based on a project (all project scope) but you can also have multiple boards for a single project! The idea coming to my mind would be to get the sprint list associated with boards and get the board scope but that's definitely a tricky one!
Hope this helps!
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Which is great for active sprint (as long as you have only one) but won't work for the last 3 sprints. Maybe something can be done with Sprint IDs?
That's definitely the sprintManager which will help and that example is a great start point which will just need a few more tweaks @Dan27 :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Dan27 where do you run the script?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try first in the Script Console and kindly provide erros
package examples.docs
import com.atlassian.greenhopper.service.rapid.view.RapidViewService
import com.atlassian.greenhopper.service.sprint.SprintIssueService
import com.atlassian.greenhopper.service.sprint.SprintManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.onresolve.scriptrunner.runner.customisers.JiraAgileBean
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
/**
* Configurable section
*/
// Enter the name of the board to which you want to add the issue to the first active sprint
def rapidBoardId = 2L
@WithPlugin("com.pyxis.greenhopper.jira")
@JiraAgileBean
RapidViewService rapidViewService
@JiraAgileBean
SprintIssueService sprintIssueService
@JiraAgileBean
SprintManager sprintManager
Issue issue = ComponentAccessor.getIssueManager().getIssueObject("your issue key")
def loggedInUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def view = rapidViewService.getRapidView(loggedInUser, rapidBoardId).getValue()
if (! view) {
log.warn("No view with this ID found")
return
}
def sprints = sprintManager.getSprintsForView(view).getValue()
def activeSprint = sprints.find { it.active }
log.debug activeSprint
if (activeSprint) {
log.info "Adding issue $issue to ${activeSprint.name}"
sprintIssueService.moveIssuesToSprint(loggedInUser, activeSprint, [issue] as Collection)
}
else {
log.info ("No active sprints were found for board: ${view.name}")
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When you open a board, have a look at the url. There must be something like rapidview=<numeric>. This numeric is the id.
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.
Hi @Alexey Matveev and @miikhy ,
I succeed to take the active sprint, now I would like to get the 2 previous sprints.
Do you have an idea how can I do it ?
Thanks,
Daniel
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.