Extend your Jira workflow with natural language rule
Workflow is where Jira’s power is rooted in. In order to meet thousands of customers different needs, Jira workflow has to be extremely flexible.
By default Jira provides some mechanisms to extend workflow:
- condition - check that a transition should be performed by the user
- validator - check that any input to the transition is valid
- post-fucntion - carry out additional processing, after a transition is performed
WorkflowRules leverages these extension points to intervene in workflow execution so that the behavior at each step could be changed by using natural language rule.
You may be wondering what is natural language rule?
In short, it is a little language that reads like natural language and works like a script for defining flexible workflow logic.
Let’s take a look at a few examples.
Condition Rule
Here are a couple of simplest condition rules:
I believe the above examples are pretty self-explanatory. They are essentially simple boolean expressions that are to be evaluated by workflow runtime before it determines if the transition is allowed or not.
Below is a slightly more complex rule:
In this case multiple logical operators (and, or) are being used to express the combination of boolean predicates. Parentheses are allowed for sure to group the expressions.
High-order rules are supported. For example, in order to test all sub-tasks are in the status of Done:
The expression in the parentheses will be lazily evaluated against each sub-task and the result will aggregated. This is analogous to high-order functions in functional programming concept.
Validator Rule
Validator rule is pretty much the same as condition rule, except that it allows to specify an optional message when validation fails.
Post-function Rule
As for post-functions, it uses the form of if
I guess now you have some idea about what workflow rules are.
It is a set of little languages for different purposes in Jira workflow. It is straightforward and understandable to everyone. The vocabulary is familiar to Jira user no one really needs to “learn“ it.
But is it really possible for casual users to write it given its verbosity? That’s a valid concern.
Editor
We have created a web-based editor to achieve this goal as our perception is it is hard to write such relatively verbose languages without proper tooling. The editor provides controlled editing experience through syntax highlighting, auto completion and error rendering. With the smart assistance, it is really easy for anyone to write rules and hard to make mistakes.
Hope you now have a good understanding of what Workflow Rules can do. I will explain more details on the language and the underlying model in the next few blogs.
Feel free to comment or drop a line if you have any questions.
Comments
There are currently no comments on this article, be the first to add one below
If you are looking for a response to your comment, either leave your email address or check back on this page periodically.