Configuring workflows can be a painful thing, especially when there are similar transitions used in 10 different places and they get changed every now and then. The change might be the simplest thing possible, such as editing just the name of the transition, but we still end up modifying it in 10 places.
This is where OSWorkflow's common actions come to our rescue. These are transitions that can be shared across the various statuses. The most important thing to remember here is that the target status of the common transitions will be the same, and they share the same workflow elements like triggers, conditions, validators, post functions, and even transition properties.
The default workflows in JIRA come with some common transitions. For example, the Software Simplified Workflow comes with common transitions like In Progress and Done. If you need to modify one of these transitions, you need to modify it only once and the change will be made everywhere. If we modify the Done transition name to Done Modified, it changes everywhere, as shown below:
In this recipe, let us look at adding a new common transition.
The first step in adding a common transition is to create a workflow transition, with all the required elements in it. Let us assume that we have added a new Rejected state in our workflow and created a transition from In Progress to Rejected state, named Reject.
If we need to add the same transition, that is, to Rejected state from another source status like To Do, we can do this by creating a common transition.
The following is the step-by-step procedure:
With that, the common transition is created! You can use the same transition again by following steps 2-4.
JIRA workflows fundamentally use OpenSymphony's OSWorkflow, as we saw in Chapter 2, Understanding Plugin Framework. OSWorkflow gives us the flexibility to add common actions by modifying the workflow XML. JIRA provides the icing on the cake by providing a powerful HTML editor that can be used to create these common transitions very easily.
The following screenshot is how the updated workflow looks in the Text view:
As you can see, the new transition has the same ID, 41
, from both To Do and In Progress states. We can modify any attribute on this transition, and it will be reflected in all the places where the transition is used.
3.15.172.195