Attempting an alternate solution to my post here: https://community.atlassian.com/t5/Jira-questions/Add-a-status-to-a-workflow-programmatically-com-atlassian-jira/qaq-p/2178063
We are going through a conversion (of 1,000s of projects) from Simplified Workflow to Fixed Workflows. The challenge is we have one issue type where we want to maintain existing statuses that have been defined on the board.
In my other post I describe the issue with attempting to "add" a status to a workflow (using com.atlassian.jira.workflow.edit.WorkflowStatuses). Alternatively, I have tried taking a copy of the original simplified workflow with all the statuses and then deleting any steps related to statuses no longer necessary.
WHAT WORKS:
Using ProjectRapidViewService.findRapidViewsByProject I retrieve all the boards for the project. From there I create a list of statuses to keep. I then use ComponentAccessor.workflowManager.copyWorkflow to create a copy of the simplified workflow.
WHAT DOESN'T WORK:
In both cases, with a valid StepDescriptor the removeStep(StepDescriptor) fails with the message
The documentation indicates it should reply with a boolean (true
if the remove was successful) but when it fails it stops execution and throws this error.
How can I remove the step and/or status from the workflow in the case of ?
Yes, that's correct, you can not remove a step that has one or more transitions pointed to it. You can't break the transition by leaving it hanging.
You need to change the end step of every incoming transition or delete the transitions before you can remove the step (bear in mind that includes "All" transitions).
The Boolean result you are seeing is because a Boolean statement can only be True, False or null/cannot-an-answer by definition. Obviously, the null will happen when the statement is nonsense (Is the colour of this thing a clock?), but the way the code works is not "is it yes or no?", it is "is it true? If it is, return true, otherwise return anything you want, because it's not true, so it must be false.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.