Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Why is validateTransition so picky?

Edited

I implemented a script runner post action that was intended to transition all subtasks.

The script works fine, but fails for some subtasks. After investigation I find that those issues are commented or has previously been commented by a user that was deleted from the system.

Yes I know users should not be deleted, but this seems to be one of those manual mistakes that happens in a large organization.

After recreating the user the script runs fine.

But I don't understand why the validator prevents transition because of an old comment? 

Manual transition does not care?

 

import com.atlassian.jira.component.ComponentAccessor

def issueService = ComponentAccessor.getIssueService()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()


def subTasks = issue.getSubTaskObjects()
subTasks.each {
    
    if (it.statusObject.name == "Open") {
        def issueInputParameters = issueService.newIssueInputParameters()
        issueInputParameters.with {
            setSkipScreenCheck(true)
        }

        // validate and transition subtask        
def validationResult = issueService.validateTransition(user, it.id, 21, issueInputParameters) if (validationResult.isValid()) { def issueResult = issueService.transition(user, validationResult) if (!issueResult.isValid()) { log.warn("Failed to transition subtask ${it.key}, errors: ${issueResult.errorCollection}") } } else { log.warn("Could not transition subtask ${it.key}, errors: ${validationResult.errorCollection}") } } }

1 comment

Investigating it a bit further I realize that the validateTransition throws an exception.

Able to try/catch and implement a workaround.

Still not clear why the validation needs to check the comments of an issue to perform a Transition?

Comment

Log in or Sign up to comment