Until 5.0.0 using JMWE add-on you could set a field or comment an issue using either a Raw Value or the Result of a Groovy expression. Starting from 5.0.0, JMWE provides an option to include Groovy templates too. Using this you can template your output. This is very similar to JSP markup.
To write a simple Groovy code, <%= some Groovy code %>
To just execute a simple Groovy code, <% some Groovy code %>
Groovy templates in JMWE are used in:
- Comment issue and Comment linked issues post-function to create the body of the comment by selecting Groovy template as the Comment type
- Create/Clone issue post-function to:
- Set fields of new issue by selecting Groovy template as the Value type and
- Add a comment to the current issue by selecting Groovy template as the Comment type
- Set field value to a constant or Groovy expression and Set field value of linked issues post-functions to set a field value in the by selecting Groovy template as the Value type
- Email issue post-function to write the Subject, HTML body and Text body
- Link issues to the current issue post-function to write JQL search expression
Groovy template examples:
Write the issue key as a comment to the issue:
Issue key: <%= issue.get("issuekey") %>
<% if (issue.get("priority").name == "Critical") { %> Look out! <% } %>
<% issue.get("components").each() { %> Component: <%= it.name %> <br> <% } %>
Note that you can also "print" to the text:
<% issue.get("components").each() { print "Component: "+ it.name + "<br>" } %>