---
title: "Writing scripts in JMCF using the Groovy language"
canonical: "https://support.appfire.com/space/JMCF/465305771/Writing%20scripts%20in%20JMCF%20using%20the%20Groovy%20language"
format: markdown
---
> Macro (aura-html)


### Learning Groovy

To learn more about the Groovy language:

- **Start with our Groovy tutorial: **[**Groovy tutorial**](https://appfire.atlassian.net/wiki/spaces/JMCF/pages/465371542)
- **Introduction to Groovy:** See [Learn Groovy in Y minutes](https://learnxinyminutes.com/docs/groovy/) and [Learn Groovy in one Video](https://hackr.io/tutorial/groovy-tutorial)
- **Tutorials** - many tutorials are available online, such as [TutorialsPoint](https://www.tutorialspoint.com/groovy/groovy_basic_syntax.htm), [Groovy with SmartThings](http://docs.smartthings.com/en/latest/getting-started/groovy-basics.html) and [The Groovy 2 Tutorial](https://leanpub.com/groovytutorial/read)
- **References** - See [The Apache Groovy programming language](http://www.groovy-lang.org/documentation.html) and [The Complete Apache Groovy Developer Course](https://www.udemy.com/apache-groovy/?siteID=jU79Zysihs4-5EIfrqzMyDrVj0m5C0HU3w&LSNPUBID=jU79Zysihs4)

### Groovy in JMCF

Groovy can be used in JMCF <span style="color: #333333">to write a Groovy script in the </span><span style="color: #333333">Groovy Formula section of the custom field configuration and </span><span style="color: #333333">return the result of the evaluation. It is applicable to:</span>

- <span style="color: #333333">Calculated Date/Time custom field type, to return a</span>` ``java.util.Date`
- Calculated Duration custom field type, to return a<span style="color: #172b4d"> duration String or</span><span style="color: #172b4d"> </span><span style="color: #172b4d">a number in a Long format representing the number of seconds</span>
- Calculated Multi-select field custom field type, to return <span style="color: #091e42">a String representing a comma-separated list of option values/ids or an array of option values/ids or a collection of option objects</span>
- Calculated Multi-user field custom field type, to return a <span style="color: #091e42">String representing a comma-separated list of usernames or an array of usernames or a collection of ApplicationUser objects</span>
- Calculated Number custom field type, to <span style="color: #091e42">return a number and </span><span style="color: #333333">to format the returned value in the Format expression field</span>
- Calculated Single-select custom field type, to return <span style="color: #091e42">a String representing an Option value/id or an Option object</span>
- Calculated Single-user custom field type, to return <span style="color: #091e42">a String representing a username or an ApplicationUser object</span>
- Calculated Text Field custom field type, to return <span style="color: #091e42">a String representing a single/multi- line text.</span>

### Writing Groovy scripts in JMCF

To learn how to write groovy scripts for JMCF, see:

- [Groovy editor](https://appfire.atlassian.net/wiki/spaces/JMCF/pages/465600948) - This document explains you the Groovy editor in JMCF where you can write your Groovy scripts
- [Variables and functions used in a Groovy script](https://appfire.atlassian.net/wiki/spaces/JMCF/pages/465732169) - This document explains you the variables available for your Groovy scripts and how to create new variables in your Groovy scripts.
- [API Interfaces](https://appfire.atlassian.net/wiki/spaces/JMCF/pages/465863009) - The document details the API interfaces
- [Accessing the fields of an issue in a script](https://appfire.atlassian.net/wiki/spaces/JMCF/pages/465371580) - This document explains you on how to access the fields of an issue.
- [Groovy script tester](https://appfire.atlassian.net/wiki/spaces/JMCF/pages/465764674) - This document explains the Groovy script tester which helps you test your written script and debug it.