How to use behaviours on issue creation screen Edited



I try to use Behaviours on creation screen in order to show and become required some customfields depending of the value of another customfield.

For the moment, I try with 1 customfield depending of another customfield value but at the end I would like to show and become required customfields depending to the value of another customfield

The objective is to show/required the customfield called "VM Type" when the value of the customfield called "Equipment Type" is equal to "Virtual Server".


Below my serverside script, I don't have any error but It does'nt work.

import com.onresolve.jira.groovy.user.FormField
// *********** Customfields ***********
// customfield_16393 = Equipment Type => JIRA Insight customfield
// customfield_16420 = VM Type => Select List
// ************************************

FormField EquipmentType = getFieldById("customfield_16393")
FormField VmType = getFieldById("customfield_16420")

if (EquipmentType.getFormValue() == "Virtual Server") { //Yes

else {

 Image 1.png

For your information the customfield "Equipment Type" is a JIRA Insight customfield (Asset Management Addon).

In addition I add a screenshot of the settings of behaviour.


It's my 1st time to use behaviours and I need help.


Thank you in advance for your help.



2 answers

0 votes

Your script looks about right. Can you try it on a normal JIRA custom field type? Just to verify it works.

It's possible that behaviours won't work correctly with the custom fields types that are not provided by JIRA. 


Hello Adam,


It works with a select list ... but partially :) ...

I replace Insight customfield to select list, I check the value ID of my select list "Equipment Type 1" to show/require the field "VM Type"

import com.onresolve.jira.groovy.user.FormField
// *********** Customfields ***********
// customfield_16437 = Equipment Type 1 => Select List
// customfield_16420 = VM Type => Select List
// ************************************
FormField EquipmentType = getFieldById("customfield_16437")
FormField VmType = getFieldById("customfield_16420")
// ID "18457" correspond of the value "Virtual Server"
if (EquipmentType.getFormValue() == "18457") { //Yes
else {

In order to check if the script works, I set up the default value of "Equipment Type 1" to "Virtual Server" in order to show/require the customfield "VM Type".

The customfield "VM Type" appears and it's required (1st picture) but ... If I change the value of "Equipment Type1" normally the customfield "VM Type" should disappear and become optional but it's not working (2nd picture).


Picture 1.png


I think the new value of "Equipment Type 1" is not taking into account on the current field.



I think I see what is wrong. If you want the validation script to trigger everytime Equipment Type 1 is changed then you should attach it to that field instead rather then the VM Type field.

Let us know if that resolves your problem.

Yes it works :)

I have another question around this topic, now I want to use the same function on transition screen.

I find this post

and I want if it's the only solution or if it's have another solution?


Thank you.

I tried this:

import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.issue.fields.screen.*
import com.atlassian.jira.component.ComponentAccessor

// *********** CF Definitions ***********
FormField Nature = getFieldById("customfield_16438")// customfield_16438 = Nature of the request
FormField NatureR = getFieldById("customfield_16444")// customfield_16438 = Nature of the request reason
FormField EquipmentType = getFieldById("customfield_16437")// customfield_16437 = Equipment Type
FormField VmType = getFieldById("customfield_16420")// VM Type
FormField BackupT = getFieldById("customfield_16415")// Backup Type
FormField Port = getFieldById("customfield_16413")// Port
def fieldScreenManager = ComponentAccessor.getFieldScreenManager()
def currentscreen = getFieldScreen().id

if (currentscreen == "16507"){
// Case: Transition screen ID = 16507 => "IT-CHG MGT New Equipment Creation transition"

if (EquipmentType.getFormValue() == "18457") {
// Case Equipment Type ="18457" = "Virtual Server"

// Visible CF



I tried the method of Jamie described in the post but it's very strange it doesn't work too.

Do I 2 behaviours 1 for issue creation and second one for workflow transition or I do a mistake somewhere?



Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 13, 2019 in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


280 views 0 7
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