Is it possible to transition an issue using script post function in Create Transition

SWAPNIL SRIVASTAV February 15, 2021

I want to transition an issue to a particular status.  This execution is condition based. When an issue of a particular issue type is created, it is in "Open State". I want that if an issue of this particular issue type is created and condition is satisfied, the issue must be transitioned from "Open" to "In Analysis" state. I tried to do it via Script Post function and Script Listener using below code, but it did not work.

def actionId = 281
TransitionOptions skipConditions = new Builder().skipPermissions().skipValidators().skipConditions().build();
transitionValidationResult = issueService.validateTransition(technicalUser, issue.id, actionId,new IssueInputParametersImpl(),skipConditions)
if (transitionValidationResult.isValid()) {
transitionResult = issueService.transition(technicalUser, transitionValidationResult)
}

Any help would be appreciated.

1 answer

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 15, 2021

No, you can't execute another transition while there is one in progress.  Not with that approach anyway, your code needs to be a lot more clever than that, otherwise you end up in a situation where an issue has two status and no way of knowing which one it should be landing in.

Scriptrunner has a function that handles it right though.  Have a look at "fast track transitions" under https://scriptrunner.adaptavist.com/latest/jira/builtin-scripts.html

SWAPNIL SRIVASTAV February 15, 2021

Hello Nic Brough,

Thank you for the response.

I am aware that the "Fast-track transition feature" can be used but I cannot use it for this requirement because, the transition has to be performed by a different user and not the current user and we do not have a provision to set user here.

Hence, could you kindly let me know how to achieve this.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 15, 2021

You could try it as a listener - catch the create event, interrogate the data in the event and trigger a second transition.

Suggest an answer

Log in or Sign up to answer