Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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


1 badge earned


Participate in fun challenges

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


Gift kudos to your peers

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


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!


Change status without a transition


UPDATED - "searchResults" needed to be updated.

I wanted to create a script that would change the status of an issue without having to transition it. After a lot of searching and head banging, I was able to create a groovy script that I can run in the Script Console in ScriptRunner. This script accepts two inputs.

1 - A JQL to provide the script with a list of issues that it needs to modify.  

2 - The destination status you want the issues in.

The script will loop through the issues and "migrate" the issues into the status you Identified. 

I have found this extremely helpful for issues that get "stuck" in statuses that have no way out. I hope it will help others.


Purpose: This script is used to change the status of issues regardless of were they are in the workflow. No transition is needed to move an issue into another status. However, The destination status has to reside in the workflow.
Author: Kevin Bouman
Date: 08/06/2019
Updated: 12/26/2020 Kevin Bouman (Added instructions for updating the resolutions)

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.workflow.WorkflowManager;
import com.atlassian.crowd.embedded.api.User;
import com.atlassian.jira.web.bean.PagerFilter;
import com.atlassian.jira.config.ConstantsManager;
import com.atlassian.jira.event.type.EventDispatchOption;
import com.atlassian.jira.issue.index.IssueIndexingService;
import com.atlassian.jira.util.ImportUtils;

def searchService = ComponentAccessor.getComponent(SearchService.class);
def issueManager = ComponentAccessor.getIssueManager();
def constantsManager = ComponentAccessor.getConstantsManager();

//********************** VARIABLES ******************************

//Place the name of the Destination status
def destinationStatusName = "Approved";

If you need to update the Resolution of an issue please refer to the "ScriptRunner" Built-In-Scipt called "Bulk Fix Resolutions".
- Update the "Fix - Resolution" JQL to grab the issues you need to update the resolution for.
- Navigate to the "Bulk Fix Resolutions" built-in-script
- Select the "Fix - Resolution" JQL that you just updated.
- Select the resolution you want to update the issues to.
- Run the script

//Define the JQL to get the issues you want to affect
def jqlQuery = 'key = PRISK-613';

//********************** ********* ******************************

//Results array
def results = [];

//Get the current user
JiraAuthenticationContext authContext = ComponentAccessor.getJiraAuthenticationContext();
def user = authContext.getLoggedInUser();

//Run the JQL
SearchService.ParseResult parseResult = searchService.parseQuery(user, jqlQuery);
def searchResult =, parseResult.getQuery(), PagerFilter.getUnlimitedFilter());

//create the list that contains all the issue keys
def issues = searchResult.results.collect {issueManager.getIssueObject(};

//Loop through the list of results from the JQL.
for (MutableIssue i in issues){

//Get the workflow
WorkflowManager workflowManager = ComponentAccessor.getWorkflowManager();

def workflow = workflowManager.getWorkflow(i);
def workflowName = workflow.getName();

//Create map to store return values
def issueMap = [:];

def currentStatusName = i.getStatus().getName();

//Check if the current status is the same as the destinationStatus
if (currentStatusName != destinationStatusName){

//Get Destination Status Object
def destinationStatus = constantsManager.getStatusByName(destinationStatusName);

//Migrate issue with WorkflowManager
workflowManager.migrateIssueToWorkflow(i, workflow, destinationStatus);

//Update the issue in the DB
issueManager.updateIssue(user, i, EventDispatchOption.DO_NOT_DISPATCH, false)

//log.warn("The status of ${i.key} was changed from $currentStatusName to $destinationStatusName")

//Add to map
issueMap.put("issue", i.getKey());
issueMap.put("result", "The status was changed from $currentStatusName to $destinationStatusName");
else {
//Add to map
issueMap.put("issue", i.getKey());
issueMap.put("result", "The status of " + i.getKey() + " was not changed");

//Reindex the issue
def issueIndexingService = ComponentAccessor.getComponent(IssueIndexingService)
boolean wasIndexing = ImportUtils.isIndexIssues();
log.warn("Reindex issue ${i.key} ${}")

//Add map to results array


return results


1 answer


This could be very helpfull in some cases, I try to use it but gives some errors 


//create the list that contains all the issue keys
def issues = searchResult.issues.collect {issueManager.getIssueObject(};

Any solution? 

@Nicolás Figueroa 

I updated the code to use "searchResults.results.collect" instead of "searchResults.issues.collect". It should work for you now.

Like Nicolás Figueroa likes this

Oh this is great!

Thanks for your quick response @Bouman , Im always wandering how to solve this errors in Script, you just take a look in the libraries and update it?

Ya you can look at the documentation. A huge resource for me is the Atlassian community. You can find a lot of other scripts that use pieces that you might need. I treat them like Legos... plug and play. However that can get you in trouble so it is best to use both the community and documentation. Its also good to keep in mind that Cloud can be very different than Datacenter.

Like Nicolás Figueroa likes this

Thanks a lot for your advice,

I really explore the community but not always have the time to find the correct answers,

Have a great week!

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events