Skip to content

Instantly share code, notes, and snippets.

@jechlin
Created March 26, 2014 16:43
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jechlin/9787666 to your computer and use it in GitHub Desktop.
Save jechlin/9787666 to your computer and use it in GitHub Desktop.
package examples
import com.atlassian.greenhopper.model.validation.ErrorCollection
import com.atlassian.greenhopper.service.rapid.view.RapidViewService
import com.atlassian.greenhopper.web.rapid.view.RapidViewHelper
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.JiraAgileBean
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
@WithPlugin("com.pyxis.greenhopper.jira")
@JiraAgileBean
RapidViewService rapidViewService
@JiraAgileBean
RapidViewHelper rapidViewHelper
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def errorCollection = new ErrorCollection()
def views = rapidViewService.getRapidViews(currentUser, errorCollection)
// list names of current boards
log.debug views*.name
// create a new board for project JRA
def projectIds = [ComponentAccessor.getProjectManager().getProjectObjByKey("JRA").id as String]
def outcome = rapidViewHelper.createRapidViewForPreset(currentUser, "Board for JRA", projectIds as Set, "scrum")
log.debug outcome
if (! outcome.isValid()) {
log.warn ("Failed to create board: ${outcome.errors}")
return
}
log.info ("Create board successfully.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment