Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Info

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 see our blog.

Why the need to convert?

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 

No Format
The issue $issue.key was just updated.

and this would get rendered as 

No Format
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.

What needs to be converted

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:

Image Removed

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!

How to convert from Velocity to Mustache

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:

...


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:

Image Removed

How do I create a new action that uses Velocity rendering?

...

Our documentation has recently move to a new location! Please head on over to: http://docs.codebarrel.io/automation/#/upgrade/convert-legacy-velocity-to-smart-fields