Transition parent when subtask is in progress

Thomas Landuyt January 23, 2017

Hi,

 

We are currently searching for the same functionality as there is currently in script runner Transition parent when all subtasks are resolved but we need to finetune it a bit. We want that one subtask has been moved to in progress that the parent issue will also go into in progress

 

somebody who could help us?

3 answers

1 accepted

2 votes
Answer accepted
April January 23, 2017

Hi Thomas,

For the current JIRA version, this should work:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
Issue issue = issue
def issueService = ComponentAccessor.getIssueService()
def currentUser = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()
// Use the ID number of the transition you want in place of the "4"
def transitionValidationResult = issueService.validateTransition(currentUser, issue.parentId, 4, issueService.newIssueInputParameters())
if (transitionValidationResult.isValid()) {
    issueService.transition(currentUser, transitionValidationResult)
} else {
    log.warn("Error transitioning issue")
    log.warn(transitionValidationResult.errorCollection)
}

 

If that is more logging than you want, just delete the second log.warn line.

Happy Monday smile

Larry Wilson June 26, 2017

In the Script console the declaration of issue produces an undeclared error on the assignment?

"The variable [issue] is undeclared"

1) Is (out of scope) "issue" defined when run under the post function logic?

2) Is this assuming that the running transition is ONLY run for a subtask issue? ie. is in workflow dedicated to subtask issue types?

Peter Poulsen January 24, 2019

Do I understand it right, that the script by "April" requires ScriptRunner to work? Can it be achieved without a plugin?

0 votes
Thomas Landuyt January 30, 2017

Thanks for the tip it is working correctly smile

 

0 votes
Vasiliy Zverev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 23, 2017

So, you need:

  • all issues istead of one are resolved
  • this issue must be into "Progress" status and could not have a resolution.

Is it correct?

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events