Hi @Joel Batac, I haven't tried it myself, but I believe there is a way you can do that. I googled around and came across similar posts that might help you to get more insights into this. Also, if you can provide more details of your use case, we might be able to come up with alternative solutions and suggestions if applicable.
HI Ivan, thanks for the response.
Basically I have a workflow (pls see attached image), where from New status it can transition to any of 4 statuses -Research and Analysis, Architecture Assessment, Pending Review and Ready to Refine. And all those those 4 statuses can transition to each other as well as go back to New.
My user what to see the transition button to follow -
New > Research and Analysis > Architecture Assessment > Pending Review > Ready to Refine.
I set the opsbar setting as :
Cancel = 10
Research and Analysis = 20
Architecture Assessment = 30
Pending Review = 40
Ready to Refine = 50
The first 2 times of transitioning are fine, - from New to Research and Analysis, from Research and Analysis to Architecture Assessment. But after the second transition, it shows Research and Analysis again, which is expected based on the opsbar setting. I want to show Pending Review instead. And after this, Ready to Refine.
How can this be achieve?
Before we get into this rabbit hole, which version are you in and what are the plans to upgrade to Jira 9.x version? I'm saying it because the issue status and transitions have a different look and feel from Jira 9 onward, and the effort you're putting into this may not make sense once you upgrade. I'm trying to help you understand whether the juice is worth the squeeze in your case.
Right. Did you check the link I shared with the new view for issue status and transition? Do you know when you're instance will get upgraded to 9.x?
Now, back to your implementation, did you try to put a code together based on the references I shared initially? I can try to carve out some time this week to attempt this if nobody else chimes in here.
I tested the script in post function to set Research and Analysis transition opsbar setting from 10 to 60 but got the ff:
at com.atlassian.jira.workflow.JiraWorkflow$getLinkedStep.call(Unknown Source)
Map attributes = new HashMap()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def workFlowManager = ComponentAccessor.getWorkflowManager()
def workflow = workFlowManager.getWorkflow("Standard Template Initiative Workflow")
def status = ComponentAccessor.getConstantsManager().getStatus("Research and Analysis") /// this is line #9
def stepDescriptor = workflow.getLinkedStep(status)
The code above didn't work for me either. Therefore, I put this one together and tested it with a simple workflow, which worked. Give it a try. I suggest you try it in the script console before diving into your logic so you can confirm it's working as expected.
import com.atlassian.jira.workflow.WorkflowManager import com.atlassian.jira.component.ComponentAccessor import com.opensymphony.workflow.loader.ActionDescriptor def workflowManager = ComponentAccessor.getWorkflowManager() def workflow = workflowManager.getWorkflow("YOUR WORKFLOW NAME") Collection<ActionDescriptor> actionToDo = workflow.getActionsByName("To Do") Collection<ActionDescriptor> actionInProgress = workflow.getActionsByName("In Progress") Collection<ActionDescriptor> actionDone = workflow.getActionsByName("Done") Map<string, string> map1 = new HashMap() map1.put("opsbar-sequence", "10") actionToDo.setMetaAttributes(map1) Map<string, string> map2 = new HashMap() map2.put("opsbar-sequence", "20") actionInProgress.setMetaAttributes(map2) Map<string, string> map3 = new HashMap() map3.put("opsbar-sequence", "30") actionDone.setMetaAttributes(map3)
cool..thanks for this. Although i found a workaround before seeing this, still appreciated the help.
Workaround was to update the XML and rearrange the 'common-action id' entries for each steps - putting the first transition at the top.
<step id="4" name="Architecture Assessment">
<common-action id="391" /> #### Pending Review transition
<common-action id="401" />
<common-action id="381" />
<common-action id="411" />