Converting legacy rendering

This page is only relevant to you if you upgraded from the old 'Jira Automation' add-on by Atlassian Labs to 'Automation for Jira' by Code Barrel. If you are a new user and never upgraded, then this documentation does not apply!

For more details on the different versions please our comparison lite vs pro.

Who this guide is for

The old 'Jira Automation' add-on used Velocity to render issue values when using the 'Comment action' or 'Edit issue' action in an automation rule.  So for example you could write a comment like

The issue $issue.key was just updated.

and this would get rendered as

The issue TEST-1234 was just updated.

The new 'Automation for Jira' add-on uses Mustache to render issue values.  We chose to use Mustache mainly for simplicity, however also for security. Velocity allows far more access to Jira internals and could lead to insecure code execution.

However to make the upgrade as simply as possible we introduced legacy Velocity rendering into the new 'Automation for Jira' such that your existing rules will continue to work after the upgrade.  The only restriction is that for security reasons those rules cannot be converted to project specific rules and Velocity rendering wont work for imported rules in Cloud (you will have to convert imported rules to use smart-values).  There's also less features available and you should try to upgrade them to Mustache as soon as possible.

Converting legacy values

Luckily only the 'Comment' and 'Edit issue' actions used this rendering mechanism.  For 'Edit issue' this was only the case if the 'Allow variable expansion' checkbox was checked.  When upgrading to the new Automation for Jira we detect which components are using legacy rendering. After the upgrade these components will show the following warning:

Velcoity Warning

This means that currently this comment will be rendered using Velocity.  Once the 'Enable smart-value rendering' button is clicked, this comment action will switch to Mustache rendering.  This operation cannot be undone!

In general the conversion should be pretty straightforward.  The old Velocity renderer only provided the following context objects:

  • issue
  • reporter
  • project
  • customfields

Here's a general guide for how to convert these:

{% raw %}

Old Velocity value Mustache expression
$issue.key {{issue.key}}
$issue.summary {{issue.summary}}
$reporter.displayName {{issue.reporter.displayName}}
$project.name {{issue.project.name}}
$customfields.get(10232) {{issue.customfield_10232}} (or you could substitute 'customfield_10232' with the name of the customfield)

{% endraw %}

See our smart-value documentation for more detailed examples!

So in our comment example shown in the screenshot above:

  1. You'd simply convert 'Hello $issue.key' to 'Hello {{issue.key}}'
  2. Then hit the 'Enable smart-value rendering' button

That's it. This is how the comment action would look like:

Velcoity Upgraded

Once you've upgraded, you can't create new actions that use Velocity any longer. Velocity is dead - Mustache and smart-values are the way of the future.