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.
Using scriptrunner, I can get the board & statuses. I can also copy the workflow to establish it with base/common statuses but what I need is for any board status not on the specific workflow, add it.
The class com.atlassian.jira.workflow.edit.WorkflowStatuses has the method
but any import does not recognize it and the
results in an error wiping out the scriptrunner declaration.
Looking at com.atlassian.jira.workflow.edit.WorkflowStatuses using
yields:
)\n)\n\n, genericSignature0:null, annotation:false, interfaces:[], anonymousClass:false, enclosingMethod0:null, simpleName:WorkflowStatuses, name:com.atlassian.jira.workflow.edit.WorkflowStatuses, enclosingMethod:null, genericInterfaces:[], annotationType:null, declaredClasses0:[], genericSuperclass:null, enclosingMethodInfo:null, simpleBinaryName:null, enclosingClass:null, canonicalName:com.atlassian.jira.workflow.edit.WorkflowStatuses, componentType:null, typeParameters:[], typeName:com.atlassian.jira.workflow.edit.WorkflowStatuses, genericInfo:null, enumConstants:null, annotatedSuperclass:null, signers:null, declaringClass:null, declaredClasses:[], reflectionFactory:sun.reflect.ReflectionFactory@3951679c, package:package com.atlassian.jira.workflow.edit, synthetic:false] |
which looks corrupted.
Any ideas? Alternatives?
Answering my own question, I am able to now add global statuses (all statuses -->) to a workflow. The key code elements are:
// libraries:
import com.atlassian.jira.workflow.edit.WorkflowStatuses
import com.atlassian.jira.workflow.edit.WorkflowStatusesImpl
// code:
WorkflowStatusesImpl workflowStatusesImpl = ComponentAccessor.getComponent(WorkflowStatusesImpl)
workflowStatusesImpl.addStatusAndGlobalTransitionToWorkflow(ComponentAccessor.getConstantsManager().getStatusByName("statusName"),"WorkflowName")
Challenge now is that it seems to require Jira administration access whereas I want to delegate to project admins. I trap the command (with try {...} / catch (ex) {...}) and no error is thrown. It just doesn't do it if you are not a Jira administrator.
Can add a status via the UI, so I'm sure it can be done.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.