All custom fields that come out of the box with JIRA have predefined purposes, such as the text field, which allows users to type in some simple text. It will often be useful to have a specialized custom field that does exactly what you need. Unfortunately, this often requires custom development efforts.
However, there is an add-on that provides a custom field type which lets you use Groovy scripts to power its logic.
In this recipe, we will look at how to create a custom field that uses a Groovy script to display the total number of comments on any given issue.
For this recipe, we need to have the ScriptRunner for JIRA add-on installed. You can download it from the following link, or install it directly from the Universal Plugin Manager at https://marketplace.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunner.
You may also want to get familiar with Groovy scripting at http://groovy.codehaus.org .