How to Move issue only specified status?(Programatically or not)


A customer wants to be able to move issue (but everyone in the developer user is allowed) from every status to only a specified status("open" status for exp.) ?

How can i restrict to status(programatically or not)

I tried with the script listener. Action is Issue Moved.

Here is my code :

import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.event.type.EventDispatchOption;
import com.atlassian.jira.issue.IssueInputParameters;
import com.atlassian.jira.bc.issue.IssueService;
import com.atlassian.jira.util.ErrorCollection;
import com.atlassian.jira.workflow.TransitionOptions;
import com.atlassian.jira.workflow.WorkflowSchemeManager;

log.warn("issue moved");
log.warn("status : " + event.getIssue().getStatus());
log.warn("Issue Type : " + event.getIssue().getIssueType());
WorkflowSchemeManager workflowSchemeManager = ComponentAccessor.getWorkflowSchemeManager();
String wfName = workflowSchemeManager.getWorkflowName(event.issue.getProjectObject(), event.issue.getId().toString());
log.warn("wfName : " + wfName);

def openStatusTransitionID = 131;
def adminUser = ComponentAccessor.getUserManager().getUserByName("safak.sahin");
MutableIssue issue = (MutableIssue)event.getIssue();

IssueService issueService = ComponentAccessor.getIssueService();
IssueInputParameters inputParameters = issueService.newIssueInputParameters();

inputParameters.setStatusId("1").setIssueTypeId("6").setSummary("updated:" + issue.getSummary());
TransitionOptions transitionOptions = TransitionOptions.defaults();

IssueService.TransitionValidationResult transitionValidationResult;
transitionValidationResult = issueService.validateTransition(adminUser, issue.getId(), openStatusTransitionID, inputParameters);
if (transitionValidationResult.isValid()) {
IssueService.IssueResult transitionResult = issueService.transition(adminUser, transitionValidationResult);
if (!transitionResult.isValid()) {
ErrorCollection errors = transitionResult.getErrorCollection();
errors.getErrors().each{k,v -> log.warn("Key : " + k + " Value : " + v)};

} else {
ErrorCollection errors = transitionValidationResult.getErrorCollection();
errors.getErrors().each{k,v -> log.warn("Key : " + k + " Value : " + v)};

And here is the log output:

                                                2018-01-19 15:30:36,856 WARN [runner.ScriptRunnerImpl]: issue moved
                                                2018-01-19 15:30:36,858 WARN [runner.ScriptRunnerImpl]: status : IssueConstantImpl[[GenericEntity:Status][sequence,45][statuscategory,4][name,Sales Approval][iconurl,/images/icons/statuses/generic.png][description,Sales Approve][id,10529]]
                                                2018-01-19 15:30:36,858 WARN [runner.ScriptRunnerImpl]: Issue Type : IssueConstantImpl[[GenericEntity:IssueType][sequence,1][name,Bug][iconurl,/secure/viewavatar?size=xsmall&avatarId=12853&avatarType=issuetype][description,A problem which impairs or prevents the functions of the product.][style,null][id,1][avatar,12853]]
This is the source issue Workflow not target ==>2018-01-19 15:30:36,881 WARN [runner.ScriptRunnerImpl]: wfName : TEST NP-MSU Workflow-deploymentsiz-w/o-DepUat
                                                2018-01-19 15:30:36,884 WARN [runner.ScriptRunnerImpl]: The workflow operation with action id '131' does not exist in the workflow.


Script Runner Listener does not work because its start just before the move event. 

Is there another way to do it? 

I'm really stuck and customer want this no matter what.

1 answer

0 vote
Tyler Brown Community Champion Jan 19, 2018

You should be able to address this issue by modifying your workflows.

Check the "Allow all statuses to transition to this one" box on your required status.

Create a group for your customers and place a permission check on the transition to the relevant status to make sure they are in the relevant group.

You may need to modify your project permissions and/or place some additional permission checks on your other transitions, but that should be able to solve your use case.

Hope this help,


Hi Tyler,

Thanks for replying. "Allow all statuses to transition to this one" is already checked.

But that status is exist in target project workflow. What i need is no matter which status has been choosen on the move issue screen, when i move the issue it must be setted the Open status.


I think your suggestion did not meet my needs.

Tyler Brown Community Champion Jan 19, 2018

So you are looking for a way to force the workflow to the "Open" status whenever a customer selects any transition step in the workflow?

My initial suggestion would not solve for that problem.

Not exactly like that.

When user move issue from one project to another, user choose a workflow status from the target projects workflow right?

Now what i want is ignore user's workflow status choice and after moving operation issue always should be setted Open status.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,233 views 14 19
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot