How to get the 'Free Text Field' type custom field value and set it as required field?

Dear all,

During I using the JIRA Behaviours Plugin to add some validations for some custom fields, I found that for 'Select List' type or 'Text Field' type, use following script code can work:


FormField AField = getFieldByName("External Party") // this is a select list type field

FormField BField = getFieldByName("DEV Remark") // this is a text field type field


if ((AField.getValue() != null) && (BField.getValue() == "")){




but, for 'Free Text Field' type field, use upper code to check, it seems can't work:

e.g. CField is a 'Free Text Field' type field, uses 'CField.getValue()' to get the input value in it, even the field contains the input value, 'CField.getValue()' still return null, and use following method to this field, it also has not any show or prompt:


CField.setError("test error")

For this case, may I ask that about 'Free Text Field' type custom field, how to get its input value and how to set it as require / set error to it? thanks.

1 answer

Instead of checking for empty strings and nulls just use "groovy truth" - ie:

if (AField && ! BField)

instead of what you have written. Empty strings and null both evaluate to false in that context.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Feb 07, 2019 in Marketplace Apps

A Timeless Love Story

It started as any story starts, on a normal, rainy day.   Admin meets App, and her name was Klok2, and like any first relationship we were both trying to make it work but neither one knew what...

429 views 8 26
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you