Transition parent when subtask is in progress

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

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

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?

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?

 

Thanks for the tip it is working correctly smile

 

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Apr 10, 2018 in Marketplace Apps

Learn about how Stefan K. built one of the *first ever* Marketplace apps

In this post you will discover more about the evolution of K15t software, some big topics they're currently focusing on in the app space, and a rare (not not funny!) photo of founders Mike Cannon-Bro...

12,828 views 11 24
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you