Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning
titleThis project is being moved!

The JIRA Misc Workflow Extensions project is being moved to a new site.

Until the migration is done, please refrain from posting comments on this page, as they will be lost once the migration is done.
Likewise, you are currently unable to create new issues or participate to existing ones.

 

Table of Contents

Installation

Versions < 2.0

...

Note
titleUpgrading from 1.x to 2.x

If you are upgrading from version 1.x to version 2.0 or above, you must make sure that you delete jira-misc-workflow-extension-1.x.jar from atlassian-jira/WEB-INF/lib before installing the new version in jira-data/plugins/installed-plugins.

Also note that the Universal Plugin Manager will not offer to upgrade from version 1.x automatically.

Description/Features

Excerpt

This plugin provides a set of workflow extensions (conditions, validators and post-functions) that you can use to customize your JIRA workflows.

Anchor
Conditions
Conditions
Conditions

...

Tip
titleWhy on Earth would I need something like this?

A typical use for this workflow condition is when you can reach a certain Status from several other Statuses (through the same Transition) and want to be able to return to the originating Status.
Consider the following partial workflow :

JIRA will allow you to create a single Transition from both Open and In Progress statuses to the Waiting for clarification status. But how do you create the transition (Provide info) back to Open and In Progress? And, more importantly, how do you make sure the issue is transitioned back to the originating status?
Here's the trick:

  1. create two Provide info transitions, one from Waiting for clarification to Open, and another from Waiting for clarification to In Progress (just add a space at the end of the name of one of the two transitions so that JIRA doesn't complain about duplicate transition names).
  2. on the first transition, add a Previous Status Condition to make the transition available only if the previous status was Open (don't forget to check the "Most recent status only" checkbox).
  3. on the second transition, add a Previous Status Condition to make the transition available only if the previous status was In Progress (don't forget to check the "Most recent status only" checkbox).

And voilà! Your users will see only one transition from the Waiting for clarification status, and it will transition the ticket back to the originating status.

Note that you could also use an advanced feature of JIRA that allows you to define conditional "<result>" elements in the XML definition of a transition, but you need to edit the workflow XML and this is definitely not for the faint of heart. Below is an example XML snippet extracted from a workflow XML (only the transition XML is shown):

Code Block
xml
collapsetrue
xml

<action id="801" name="Provide Information" view="fieldscreen">
  <meta name="jira.description">Provide the requested information</meta>
  <meta name="jira.fieldscreen.id">10010</meta>

  <validators>
  	<!-- Force the user to provide a comment -->
	<validator name="" type="class">
	  <arg name="errorMessage">You must provide your answer in the Comment field.</arg>
	  <arg name="class.name">com.innovalog.jmwe.plugins.validators.CommentRequiredValidator</arg>
	  <arg name="hidGroupsList"></arg>
	</validator>
  </validators>

  <results>
  	<!-- Conditional results (transitions) first -->
  	<!-- First possible destination step: 1 ("Backlog") -->
	<result old-status="Not Done" status="Done" step="1">
	  <conditions>
	  	<!-- Transition will only be available when coming from the "Backlog" status -->
		<condition type="class">
		  <arg name="jira.previousstatus">Backlog</arg>
		  <arg name="class.name">com.innovalog.jmwe.plugins.conditions.PreviousStatusCondition</arg>
		  <arg name="jira.mostRecentStatusOnly">yes</arg>
		</condition>
	  </conditions>
	  <post-functions>
	  	<!-- restore former assignee field from custom field "Previous Assignee" -->
		<function type="class">
		  <arg name="sourceField">customfield_10090</arg>
		  <arg name="destinationField">assignee</arg>
		  <arg name="class.name">com.googlecode.jsu.workflow.function.CopyValueFromOtherFieldPostFunction</arg>
		</function>
		<!-- standard Jira functions follow -->
		<function type="class">
		  <arg name="class.name">com.atlassian.jira.workflow.function.issue.UpdateIssueStatusFunction</arg>
		</function>
		<function type="class">
		  <arg name="class.name">com.atlassian.jira.workflow.function.misc.CreateCommentFunction</arg>
		</function>
		<function type="class">
		  <arg name="class.name">com.atlassian.jira.workflow.function.issue.GenerateChangeHistoryFunction</arg>
		</function>
		<function type="class">
		  <arg name="class.name">com.atlassian.jira.workflow.function.issue.IssueReindexFunction</arg>
		</function>
		<function type="class">
		  <arg name="class.name">com.atlassian.jira.workflow.function.event.FireIssueEventFunction</arg>
		  <arg name="eventTypeId">10008</arg>
		</function>
	  </post-functions>
	</result>

  	<!-- Second possible destination step: 1 ("In Progress") -->
	<result old-status="Not Done" status="Done" step="3">
	  <conditions>
		<condition type="class">
		  <arg name="jira.previousstatus">In Progress</arg>
		  <arg name="class.name">com.innovalog.jmwe.plugins.conditions.PreviousStatusCondition</arg>
		  <arg name="jira.mostRecentStatusOnly">yes</arg>
		</condition>
	  </conditions>
	  <post-functions>
		<function type="class">
		  <arg name="sourceField">customfield_10090</arg>
		  <arg name="destinationField">assignee</arg>
		  <arg name="class.name">com.googlecode.jsu.workflow.function.CopyValueFromOtherFieldPostFunction</arg>
		</function>
		<function type="class">
		  <arg name="class.name">com.atlassian.jira.workflow.function.issue.UpdateIssueStatusFunction</arg>
		</function>
		<function type="class">
		  <arg name="class.name">com.atlassian.jira.workflow.function.misc.CreateCommentFunction</arg>
		</function>
		<function type="class">
		  <arg name="class.name">com.atlassian.jira.workflow.function.issue.GenerateChangeHistoryFunction</arg>
		</function>
		<function type="class">
		  <arg name="class.name">com.atlassian.jira.workflow.function.issue.IssueReindexFunction</arg>
		</function>
		<function type="class">
		  <arg name="class.name">com.atlassian.jira.workflow.function.event.FireIssueEventFunction</arg>
		  <arg name="eventTypeId">10008</arg>
		</function>
	  </post-functions>
	</result>

  	<!-- Last possible destination step: 7 ("Resolved") -->
	<unconditional-result old-status="Not Done" status="Done" step="7">
	  <!-- no condition - will be executed if no conditional result above matched -->
	  <post-functions>
		<function type="class">
		  <arg name="sourceField">customfield_10090</arg>
		  <arg name="destinationField">assignee</arg>
		  <arg name="class.name">com.googlecode.jsu.workflow.function.CopyValueFromOtherFieldPostFunction</arg>
		</function>
		<function type="class">
		  <arg name="class.name">com.atlassian.jira.workflow.function.issue.UpdateIssueStatusFunction</arg>
		</function>
		<function type="class">
		  <arg name="class.name">com.atlassian.jira.workflow.function.misc.CreateCommentFunction</arg>
		</function>
		<function type="class">
		  <arg name="class.name">com.atlassian.jira.workflow.function.issue.GenerateChangeHistoryFunction</arg>
		</function>
		<function type="class">
		  <arg name="class.name">com.atlassian.jira.workflow.function.issue.IssueReindexFunction</arg>
		</function>
		<function type="class">
		  <arg name="class.name">com.atlassian.jira.workflow.function.event.FireIssueEventFunction</arg>
		  <arg name="eventTypeId">10008</arg>
		</function>
	  </post-functions>
	</unconditional-result>
  </results>
</action>

You can also restore the previous Assignee by saving it in a custom field during the Request clarification transition and then restoring it during the Provide info transition (see Copy Value From Other Field workflow function in JIRA Suite Utilities). Alternatively, you can use the Assign to last role member function described below to assign the issue to the last user in the Users role.

...