Bulk Modify workflow's status

Hi,

I'm doing some cleaning in my jira. I would like to suppress status that are "alike".

To do that, the status must not be used by any workflow.

In order to do that i need to open each workflow that contain this status and change it. (this step is not as simple as it seems)

Since i have something like 300 workflows to edit, i started to work on a script.

i've manage to find all the workflow that countain the status i want to change.

Now i need to find the function that can edit the status in a workflow.

the function "getLinkedStatusObjects" allow to see all the status in a workflow. Is there a function, that could do updateStatusFromWorkflow(JiraWorkflow jw, Status oldStatus, Status, newStatus) ?

Or, is there any other way to manipulate the status in a workflow by using Jira API ?

Regards,

Laurent

1 answer

1 accepted

Hello community !

It seems that i found the solution of my issue.

I'm not sure if it's the best solution but it works.

Actually, once you have all your workflow in a list, you have to use "step" to modify your status.

By the way, it is very bad documented in the Jira API since the link to the object StepDescriptor is dead. (at least for me)

To manage to modify the status i used "getLinkedStep" (a workflow function) to retrieve the step.

Then "setName(NewName)", "getMetaAttributes().put("jira.status.id", idNewStatus)" and "setParent(it.getDescriptor())" (all are StepDescriptor functions and "it" is a workflow).

I find the solution thanks to this post in the atlassian dev community:

https://community.developer.atlassian.com/t/create-workflow-through-java-api/4232

Regards,

Laurent

(in the API the notion of "step" is cover by the "StepDescriptor" object)

Can you please post the code it will really helps!

Even I'm trying for clean up and bull edit status.

 

Thanks

Dave

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

77 views 0 5
Read article

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