Our new Appfire Documentation Space is now live!

Take a look here! If you have any questions please email support@appfire.com

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 22 Next »

This document is intended to JMCF add-on users that are migrating from 1.x to 2.x. JMCF has moved from BeanShell Scripting to Groovy from 2.x. It 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 should be taken care of after migration.

On this page:

During the migration from 1.x to 2.x

An upgrade task is run to copy 

  • Transition names or IDs provided under @Transition Id or @TransitionName tags to Transition(s) to look for field of the custom field configuration
  • Transition execution details provided under @Execution to Transition Execution field of the custom field configuration
  • Format provided under the @@Format tag to Date Format field of the custom field configuration
  • Format provided under the @@ColFormat tag to Date Column Format field of the custom field configuration
  • Field name provided under @@Field tag to the Field to look for field of the custom field configuration

and all the above-mentioned tags are commented with a warning and are ignored in 2.x.

Post-migration from 1.x to 2.x

It is suggested to perform a non-regression testing before starting to take advantage of the new features in the add-on. 

The calculated fields with BeanShell scripts inside the field's Description use the legacy script as long as you don't save the new configuration. To save the new configuration;

  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/Edit Format Expression.
  4. The Formula under the @@Formula tag will be copied to the Groovy formula.
  5. Click on Save.

When you save the Groovy formula or Format Expression:

  1. The script will be converted to Groovy language and will be stored, upon saving, outside of the field's Description. 
  2. The BeanShell scripts are commented with a warning and ignored in 2.x.

While Groovy is generally compatible with the BeanShell language, some scripts might need to be adjusted. Here are a few syntaxes of BeanShell scripts that you might want to modify to make them Groovy compatible. 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:

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:

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

returns 3

Unsupported commands -  unset(), invoke()


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

returns a MissingMethodException


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

returns a MissingMethodException

  • No labels