What needs to be done between 2 consecutive calls to (validateTransition/transition)

I like to push an issue programmatically through the workflow, by calling IssueService .validateTransition and then IssueService.transition.

And it works for a single transition.

Now if I want to push it through the second transition in the same plot, then the second validateTransition failed, saying that there was another who changes it. I believe that this means the first transition was not totally recorded.

How can we fast track 2 transitions in one operation?

 

1 answer

0 vote
Steven Behnke Community Champion May 12, 2017

Can you show us your code? You should wait until the next event fires before attemping the second fast-track.

In groovy code, it's simply

def action = wfm.getWorkflow(issue).allActions.find { it.name == transitionName }
IssueService.TransitionValidationResult res = is.validateTransition( execUser, issueKey.id, action.id, issueInputParams )
if (!res.valid) {
     throw new IssueTrackerException(
                        "Validation failed  "+ tvr.errorCollection.reasons  )
 }

def tres = is.transition(execUser, res)

But I want to transition the bug through 2 transitions right in this event. is there any way not to wait for the next event to do it?

Steven Behnke Community Champion May 15, 2017

To be honest, I am not sure. It may require some testing. Personally, I would not think that would be possible. My impression however is that data is only stored on issue events. If the data from the first action hasn't been stored, the second action is invalid.

Given: Open -startprogress> In Progress -close> Close

Not working:

  1. startprogress sets state from Open to In Progress (Succeeds)
  2. close attempts to fire from Open to Close (Fails)
  3. Store issue
  4. Fire Event

Should work:

  1. startprogress sets state from Open to In Progress (Succeeds)
  2. Store issue
  3. Fire Event
  4. close attempts to fire from Open to Close (Succeeds)
  5. Store issue
  6. Fire Event

 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published 4 hours ago in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

16 views 0 3
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