Hi All,
i am new to groovy. can someone help me with a script for post function that will do the following.
when moving story to done, change the story parent epic to done as well if all the stories that belong to the parent epic are also in done.
thanks in Advanced,
Erez
Here're the steps:
Use the samples below to construct your own script.
Use this to create a check of all stories in epic are Done. The JQL should be something like
"Epic Link" = issue.parent.key
package examples.docs import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.search.SearchProvider import com.atlassian.jira.jql.parser.JqlQueryParser import com.atlassian.jira.web.bean.PagerFilter def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser.class) def searchProvider = ComponentAccessor.getComponent(SearchProvider.class) def issueManager = ComponentAccessor.getIssueManager() def user = ComponentAccessor.getJiraAuthenticationContext().getUser() // edit this query to suit def query = jqlQueryParser.parseQuery("project = JRA and assignee = currentUser()") def results = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter()) results.getIssues().each {documentIssue -> log.debug(documentIssue.key) // if you need a mutable issue you can do: def issue = issueManager.getIssueObject(documentIssue.id) // do something to the issue... log.debug(issue) }
Use the com.onresolve.scriptrunner.canned.jira.utils.WorkflowUtil helper to transition the parent if the condition is true
/** * Transitions the issue. If it fails, the errorCollection should have some deep validation on why it failed, but this is also logged * * @param additionalScript * @param theIssue * @param actionId * @param user * @param scriptParams * @return an IssueResult */ public static IssueService.IssueResult actionIssueWithFeedBack(String additionalScript, MutableIssue theIssue, Integer actionId, User user, Map scriptParams = [:]) {
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.