Versions Compared

Key

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

This document is intended for JMCF users who are migrating from version 1.7 to version 2.x. JMCF has moved from BeanShell Scripting to Groovy, and also has a vast number of advanced features and new custom fields to offer. Though the migration is pretty straightforward there are certain things that you need to be aware of.

...

  • Transition names or IDs provided under @Transition Id or @TransitionName HTML comments to the Transition(s) to look for custom field configuration option
  • Transition execution details provided under under an @Execution HTML comment to the Transition Execution custom field configuration option
  • Formats provided under an @@Format HTML comment to the Date Format custom field configuration option
  • Formats provided under under an @@ColFormat HTML comment to the Date Column Format custom field configuration option
  • Field names provided under under an @@Field HTML comment to the Field to look for custom field configuration option

...

Migrating from BeanShell to Groovy

BeanShell scripts inside the field's Description will continue to be used, and will be evaluated using the BeanShell scripting engine, until you edit and save them on the custom field's Configure screen. Once they are saved on that screen, they will replace the corresponding script from the field's Description, and will from now on be evaluated using the Groovy scripting engine.

To convert a BeanShell script to Groovy:

  1. Locate the custom field on the Custom Fields administration page.
  2. Click on the cog wheel and click on Configure
  3. Click on Edit Groovy Formula or Edit Format Expression.
  4. The Formula under the @@Formula HTML comments will be copied to the Groovy formula custom field configuration option.
  5. Click on Save.

When you save the Groovy formula or Format Expression:

  1. The script will be converted to the Groovy language and will be stored, upon saving, outside of the field's Description. 
  2. The HTML comment containing BeanShell script in the field's Description will be modified to include the following warning:  WARNING: ignored in JMCF 2.x. Edit the field's Configuration instead.

While Groovy is generally compatible with the BeanShell language, some scripts might need to be adjusted. Here are the main syntax differences that you will need to take into account, although it is very unlikely that you will encounter them in your scripts. 

We strongly encourage you to test your script before saving, using the "Test groovy script" button at the top of the editor.

DescriptionExampleReplace with
You can define a method implicitly in BeanShell. But the Groovy interpreter considers it as a Closure.

For example:

Code Block
add( int a, int b ) {
return a + b;
}
foo = add(1, 2);
return foo; // 3

returns a compilation error

You need to define the method explicitly as:

Code Block
def add( int a, int b ) {
return a + b;
}
foo = add(1, 2);
return foo; 

returns 3

Unsupported commands -  unset(), invoke()


Code Block
int a;
a == void; // true
a=5;
unset("a"); // note the quotes
a == void;

returns a MissingMethodException


Code Block
def invoke( String methodName, Object [] arguments ) { 
	"You invoked the method: "+ methodName; 
} //invoke() will be called to handle noSuchMethod() 
noSuchMethod("foo");

returns a MissingMethodException

No equivalent exists in Groovy.

...

  1. Log in to Jira as an administrator.

  2. Click on the Administration icon Navigate to Add-ons > Manage Add-ons.

  3. Under User-Installed Add-ons, search for Jira Misc Workflow ExtensionsCustom Fields and click on it. 
  4. Click on Uninstall.
  5. Download version 1.7.2 of JMCF from this link
  6. Click on  and upload the jar file.

...