General clean-up in Jira : Starting with workflow and statuses (how to change the status of an issue ?)

Hi !

I’m starting some huge cleaning in my french jira.
One of the first things that annoyed me are the multiple status that have the same use.
I have several status that are duplicate like “TO DO”, “TODO”, “A faire”, “A faire / TO DO”…

I want to reunite all those status in one unique “To Do” that i would translate in french.

To do that, i need to change all the workflows that contains the old status, here’s my code:

[code]workflowManager.workflows.each {
it.getLinkedStatusObjects().each {
if ( == idOldStatus) {
StoredOldStatus = it // not opti at all but it works
hasStatus = 1
if (hasStatus == 1) {
hasStatus = 0
listWorkflowWithStatus.each(){ workflow->
if (workflow.isSystemWorkflow() == false){
StepToModify = workflow.getLinkedStep(StoredOldStatus)
StepToModify.getMetaAttributes().put(“”, idNewStatus);


return sb2.toString()


So far it’s working, the status is successfully change in every workflow that contain the old Status.

That’s the first step ! If anyone have any suggestion about how i have done it, it will be welcomed :slight_smile:

Once there is no more workflow associated to the status i can delete the status ! However delete the status somewhat “delete” all the issue that were in that status. Therefore, i can’t delete the status like that.
At this point i have two choice:
- i manage to transition all the issue the way i want before deleting
- i do the change and wait that no more issue are in the status before deleting it.
The second solution seems great but it’s not possible if the status is at the end of the workflow.

That’s why, i need to transition all the issue that are in the state i want to suppress.
After some research it appears to me that i couldn’t just do something like “issue.statusId = idNewStatus” and that i have to go trough the IssueService functions. Here’s my code:

IssueInputParameters issueInputParameters = issueService.newIssueInputParameters()

Project projetTraite = ComponentAccessor.projectManager.getProjectObjByName(“WKFTest”)
ComponentAccessor.issueManager.getIssueIdsForProject( {
if (ComponentAccessor.issueManager.getIssueObject(it).statusId == idOldStatus){
TransitionValidationResult transitionValidationResult = issueService.validateTransition(currentUser, ComponentAccessor.issueManager.getIssueObject(it).id, 1, issueInputParameters);

				if (transitionValidationResult.isValid()) {
				    IssueResult transitionResult = issueService.transition(currentUser, transitionValidationResult);
				    if (!transitionResult.isValid()) {
                                            //NOT IMPORTANT


return sb2.toString()[/code]

I choose the actionId “1” since the status is related to the first action, the id is 1. (i verified for this workflow at least).

However this part doesn’t work. Actually when you look at the workflow, the first status is only accessible at the creation. So normally jira can’t allow me to transition from my old first step to my new first step.
How can i change the status of my issue in this case ?
Here’s my workflow:

Workflow Text

To be a bit clearer, the first state was not “Ready”. Now that my workflow start with “Ready” i want my issue status to be “Ready”.



Hi again,

I thought about it and i found out that the only possibility to get this works was to add a transition to my new state.
So here’s my script’s steps:

  1. find all workflow with status to change || DONE
  2. Supress all the draft workflows || DONE
  3. Replace the old Status by the new Status in the workflows || DONE
  4. Add a transition from “all” to “NewStatus” in the workflow included || TO DO
  5. Update the issue by transition them to the new state || DONE (not working though, since there isn’t any transition to that new state allowed. That’s why i need step 4 of my script)
  6. Check that the issue is well transitionned || Considered done
  7. Remove the transition added erlier in step 4 || TO DO

Is there anyone that can help me for step 4 and 7 ? Or lead me to a proper documentation about ActionDescriptor, StepDescriptor and all ? (as far as i know, the documentation is not complete considering those aspects in

I’m eager to hear from anyone that can help me !