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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ivan,
I tested the script in post function to set Research and Analysis transition opsbar setting from 10 to 60 but got the ff:
java.lang.IllegalArgumentException
at com.atlassian.jira.workflow.AbstractJiraWorkflow.getLinkedStep(AbstractJiraWorkflow.java:204)
at com.atlassian.jira.workflow.JiraWorkflow$getLinkedStep.call(Unknown Source)
at Script24.run(Script24.groovy:9)
import com.atlassian.jira.component.ComponentAccessor
Map attributes = new HashMap()
attributes.put("opsbar-sequence","60")
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)
stepDescriptor.setMetaAttributes(attributes)
workFlowManager.updateWorkflow(user, workflow)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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[0].setMetaAttributes(map1) Map<string, string> map2 = new HashMap() map2.put("opsbar-sequence", "20") actionInProgress[0].setMetaAttributes(map2) Map<string, string> map3 = new HashMap() map3.put("opsbar-sequence", "30") actionDone[0].setMetaAttributes(map3)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
Sample
<step id="4" name="Architecture Assessment">
<meta name="jira.status.id">43200</meta>
<actions>
<common-action id="391" /> #### Pending Review transition
<common-action id="401" />
<common-action id="381" />
<common-action id="411" />
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm glad you found a workaround, but I suppose you're not setting it during a post-function nor using scriptrunner, are you?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's right. Basically hard coded. The only requirement from user is to have the next transition next to Cancel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.