Writing scripts in JMCF using the Groovy language
Introduction to Groovy
Groovy is an object-oriented programming language for the Java platform. It is a dynamic language with features similar to those of Python, Ruby, Perl, and Smalltalk. It can be used as a scripting language for the Java Platform. It is easy to learn, has smooth Java integration, vibrant and rich ecosystem and powerful features. To know more about Groovy, see the official Groovy Documentation.
On this page:
Learning Groovy
To learn more about the Groovy language:
- Start with our Groovy tutorial: Groovy tutorial
- Introduction to Groovy: See Learn Groovy in Y minutes and Learn Groovy in one Video
- Tutorials - many tutorials are available online, such as TutorialsPoint, Groovy with SmartThings and The Groovy 2 Tutorial
- References - See The Apache Groovy programming language and The Complete Apache Groovy Developer Course
Groovy in JMCF
Groovy can be used in JMCF to write a Groovy script in the Groovy Formula section of the custom field configuration and return the result of the evaluation. It is applicable to:
- Calculated Date/Time custom field type, to return a
java.util.Date
- Calculated Duration custom field type, to return a duration String or a number in a Long format representing the number of seconds
- Calculated Multi-select field custom field type, to return a String representing a comma-separated list of option values/ids or an array of option values/ids or a collection of option objects
- Calculated Multi-user field custom field type, to return a String representing a comma-separated list of usernames or an array of usernames or a collection of ApplicationUser objects
- Calculated Number custom field type, to return a number and to format the returned value in the Format expression field
- Calculated Single-select custom field type, to return a String representing an Option value/id or an Option object
- Calculated Single-user custom field type, to return a String representing a username or an ApplicationUser object
- Calculated Text Field custom field type, to return a String representing a single/multi- line text.
Writing Groovy scripts in JMCF
To learn how to write groovy scripts for JMCF, see:
- Groovy editor - This document explains you the Groovy editor in JMCF where you can write your Groovy scripts
- Variables and functions used in a Groovy script - This document explains you the variables available for your Groovy scripts and how to create new variables in your Groovy scripts.
- API Interfaces - The document details the API interfaces
- Accessing the fields of an issue in a script - This document explains you on how to access the fields of an issue.
Groovy script tester - This document explains the Groovy script tester which helps you test your written script and debug it.