A quick look at JMWE’s scripting editor

System Administration

Appfire Products

Software Development and DevOps

Hose to use scripting to create custom rules
Rachel Wright

Rachel Wright

Mar 29, 2022

Jira Misc Workflow Extensions (JMWE) comes with dozens of point-and-click configurable rules to enhance workflow capabilities. But what if you want to do more?

Hi, I'm Rachel Wright, Certified Jira Administrator and author of the Jira Strategy Workbook, and in this video, I'll show you how to use scripting to create custom rules with little to no coding experience.

There are two main ways to use scripting in JMWE. You can:

Extend existing workflow extensions

How to extend workflow conditions, validators, and post functions

First, let's look at a way to extend workflow conditions, validators, and post functions. This means that unlike with other scripting apps that require you to script your entire rules, you can simply extend any of JMWE post functions, conditions, and validators with a few lines of code, and the app will do all the heavy lifting for you. 

For example, let's make rules execute conditionally and help the IT department better track their expensive hardware requests. We'll use the "Linked Issues Validator" to require an issue link, but only for requests above 100 dollars

First, we'll select what to validate.

Linked issues validator

Then we'll add an additional condition and a simple Jira expression to check for the desired link.

Jira expression

Next, we'll add an error message to help the user meet the criteria we're checking for.

Field for error message

Finally, we'll limit the validator scope and add a condition. We'll limit this validator to issues where a custom field is 100 dollars or more. Less expensive requests will skip this validation entirely.

Conditional validation field

Here's what it looks like. This is a request for a new laptop that costs over 100 dollars. If the request is not linked to its related strategic issue, the user receives an error message. The user can add the needed link directly from the resolution overlay. After, the issue transitions as expected. Now the IT department can better associate requests to the annual technology budget.

example of new laptop ordering request

How to use scripting in values

Now, for another example, let's see how to use scripting in values.


For example, we'll set a field to a calculated value. We'll use the "Set field value" post function to automatically assign an issue based on priority.

First, select the field to set, which is "Assignee".

Set field value

Next, enter the value to set. Use the "Lookup user" feature in the editor to easily find an account ID.

Lookup user feature

Finally, add a condition to only set the "Assignee" field when the issue's priority is "High".

Conditional execution

Next, let's build on the previous example by also sending a custom email message for high priority issues. We'll use the "Email issue" post function.

Creating custom email message

First we'll add a subject for the email. I made mine dynamic by including variables for the issue priority and the issue key. Next, add the information for the body of the email. Again, I used a few variables. You can use any static text or Jira issue data in this message.

Then, I also created a version of the body copy for users who receive messages in HTML format. This is optional. If you don't know HTML, just leave the field blank and JMWE will generate it for you from the text version above.

Then it's time to determine who should receive the notification. There are lots of options, including the standard Jira fields like the assignee and reporter, specific users or users in a custom field, or you can insert email addresses to send messages to non-Jira users. I chose the recipient to be a member of the Administrators' project role.

Finally, I added conditional execution, so the message is only sent for high-priority issues.

Conditional execution

Awesome! We were able to add sophisticated functions with barely any code. With other tools, you'd need entire scripts to do these things. JMWE really makes scripting easy.

Inline help system

Use the inline help system to guide you to the proper syntax for your Jira deployment type. In Jira Cloud you can use Jira expressions or Nunjucks scripts. In Jira Server or Data Center, use Groovy. Regardless of your deployment type, the script editor looks and functions the same.

Jira expression

Build your own custom scripted conditions, validators, and post functions

The second way to use scripting is to build your own custom scripted condition, validator, or post function.

Let's say you want to further classify support requests based on component selection. For example, if the component is "email," allow "monitoring" and "troubleshooting" as support selections. If the component is "network," then allow "monitoring" and "security" selections instead.

This is easy with JMWE. We'll use the "Build-your-own (scripted)" validator. First, build the Jira expression. In this example, check that the custom field contains the allowed selections based on the component selected. Next, enter an error message to tell the user they selected an invalid response.

Build your own scripted validator

Here's what it looks like. This is an email trouble report. When progress is started, the user is asked for a Support value. If the selection is invalid, an error message is displayed at the top of the overlay. When a valid selection is entered, the issue transitions as expected.

Add error messages

Now the support team can further classify their issues. Easy, right?

My favorite editor feature is the test function. Click the "Test Jira Expression" button and enter any issue ID to check the result of the code. The editor also validates syntax as you type.

Test Jira expression

From here, you can complete the configuration or add additional code until you've achieved the desired result. Don't forget to retest the code any time you make a change. I also recommend testing what you created in Jira as well.

With JMWE's script editor, you can quickly create sophisticated workflows and rules. Use the code snippets and use case examples in the documentation for some additional ideas. What scripted rule will you build first?

Free Trial
More from Rachel Wright
More from Rachel Wright