Transitioning issue from post function results in workflow integrity error Edited

We have a ScriptRunner plugin that includes a postfunction that will, under certain circumstances, initiate an additional transition for an issue.  

For example, imagine there's an issue that's currently in Status A.  A user initiates a transition, T0, to Status B.  A post-function for T0 determines that the issue should in turn, initiate another transition, T1, to Status C.  To the user, Status B is effectively skipped.

However, upon doing so, the issue Status is B despite the fact that both the issue history and currently available transitions suggest the issue in in Status C.  And the Integrity Checker reports the following for the issue:

"The current step associated with the workflow entry with id 20373 has an incorrect stepId. (JRA-4539)"

The issue is resolved by running the Fix.  But I'd like to know *why* this is happening in the first place.  The postfunction is the last item in the list and therefore, should work.

Has anyone else run into a problem like this?

2 answers

This widget could not be displayed.
Steven Behnke Community Champion Sep 28, 2017

How are you triggering the transition?

Here's a snippet of how we're performing the transition:

public static IssueService.IssueResult transitionIssue(MutableIssue issue, int transitionId, ApplicationUser user){
IssueInputParameters issueInputParameters = ComponentAccessor.getIssueService().newIssueInputParameters()
issueInputParameters.setSkipScreenCheck(true)

// Need to validate the transition before we can actually perform it.
IssueService.TransitionValidationResult validationResult = ComponentAccessor.getIssueService().validateTransition(user, issue.getId(), transitionId, issueInputParameters);

if (validationResult.isValid()) {
return ComponentAccessor.getIssueService().transition(user, validationResult)
}

log.error("Unable to validate transition!")

log.error(formatErrorCollection(validationResult.getErrorCollection()))

null
}

 I should note that our logs aren't reporting any errors (there's also a similar isValid() check on the result of the IssueService.transition() function).

Thanks!

Shaun

This widget could not be displayed.

After digging in a bit more, this looks like a race condition in JIRA.  So we ended up bailing on doing the transition in our plugin and instead, implemented it using the SR Fast-Track Transition post function.  It adds a bit of overhead when setting up a new workflow.  But it works!

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Aug 06, 2018 in Jira Service Desk

A is for Activate: Share your top Jira Service Desk onboarding tips for new users!

Hi, everyone! Molly here from the Jira Service Desk Product Marketing Team :).  In the spirit of this month's  august-challenge, we're sourcing stories of Jira Service Desk activation fro...

528 views 23 15
Join discussion

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