This chapter covers how to create JIRA plugins for use with workflows. Conditions, validators and post-functions are each described in detail, with both nonconfigurable and configurable examples. All the source code for the examples in this chapter is available from https://marketplace.atlassian.com/41293. The standard JIRA conditions, validators, and post-functions plugins are also useful examples and can be found in the file system-workflow-plugin.xml.
Conditions control whether a transition appears in a user’s list of available workflow actions. For instance, the default JIRA workflow only shows the Start Progress transition to the current assignee of an issue. Other users don’t see the transition as a choice in their view of the issue’s actions.
Conditions are configured with the Add link on the Conditions tab of a workflow transition, as described at http://confluence.atlassian.com/display/JIRA/Configuring+Workflow#ConfiguringWorkflow-Addingacondition. You can also combine multiple conditions using AND and OR operations, but not negation.
Creating a custom condition is relatively straightforward, at least compared with custom fields and searchers. The first example is of a condition that has no configuration.
First we add a
element to atlassian-plugin.xml as
shown in Example 5-1.
<workflow-condition key="custom-noconfig-condition" name="A ...