Hi All,
I have a list of closed issues where users forgot to set the sprint fielld.
Each issue in the list belongs to a different sprint.
Those Sprints are also closed.
I fixed the problem going forward by imposing a required field validator on Sprint in a workflow transition. Now I just need to fix the old data.
The only way I know of to make this update is to use bulk edit one-by-one for each issue and set the Sprint field to equal the Sprint ID.
I was hoping that this could be done programatically.
Any guidance would be greatly appreciated.
You can do it programatically. What add-on do you have? Power Scripts or ScriptRunner?
I have Script Runner. Not very experienced in using it though.
I have a list of IssueIDs and the SprintIDs. they need to be updated with.
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.
This script worked for me
import com.atlassian.greenhopper.service.sprint.SprintManager
import com.onresolve.scriptrunner.runner.customisers.PluginModuleCompilationCustomiser
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
@WithPlugin("com.pyxis.greenhopper.jira")
def sprintManager = PluginModuleCompilationCustomiser.getGreenHopperBean(SprintManager)
def sprintServiceOutcome = sprintManager.getAllSprints()
def issue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("MAV-1")
if (sprintServiceOutcome?.valid) {
def sprint = sprintServiceOutcome.getValue().find {it.name == "Sprint 1"}
if (!sprint) {
log.debug "Could not find sprint with name <SPrint 1>"
} else {
log.error(sprint)
issue.setCustomFieldValue(
ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Sprint")
, Arrays.asList(sprint))
ComponentAccessor.getIssueManager().updateIssue(ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
, issue
, EventDispatchOption.ISSUE_UPDATED
, false)
}
}
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 , can you please help me on . When a user clicks on sprint complete button . In the back end a field Goal is set to some text data programmatically . Can you help me on this thanks. Harish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can try to build a custom script to change this
You can execute it in built in scripts (script runner) or add it as workflow post function and execute as a bulk action on closed issues
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online 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.