Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Scriptrunner: how to identify an issue type as both a Parent and Child


I have an issue type called Spikes. These Spikes can be linked at the parent level (derivation is) and as a child (is derived from).

 I have 3 custom fields A, B, and C. With custom field A always showing on the issue screen.

If Spike is a parent, and custom field A is checked Yes, then custom field B and C appears.
If Spike is a parent, and custom field A is unchecked, then B and C clears and disappears.

If Spike is a child, and custom field A is checked, then custom field C appears.
If Spike is a child, and custom field A is unchecked, then C clears and disappears.

I'm at a lost when it comes to script writing, but is it possible for write a script that can identify an issue both at a parent and child level as well as make the script run different instructions based on what level an issue is?

1 answer

1 accepted

0 votes
Answer accepted

Hi @Diana Gorv

I have doubt to clarify with you, i.e. what type of fields are you using for A, B and C? Are they checkboxes or radio buttons?

Below is an example working code that can be used for either radio buttons or checked boxes.

import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript

@BaseScript FieldBehaviours behaviours
def optionsA = getFieldById(fieldChanged)
def optionsB = getFieldByName('Options B')
def optionsC = getFieldByName('Options C')

def optionsAValue = optionsA.value.toString()
optionsB.hidden = true
optionsC.hidden = true

if (optionsAValue == 'Yes') {
if ( != 'Sub-task') {
optionsB.hidden = false
optionsC.hidden = false
} else {
optionsC.hidden = false

Please note the sample code provided is not 100% exact to your environment. Hence, you will need to make the required modifications.

In this sample code, if the issue type is Bug, Task or Story, when Options A is set to Yes, the fields Options B and Options C will be visible.

And if it is a Sub-task issue type, when Options A is set to Yes, only the field Options C will be visible.

You will need to change the code according to your environment, i.e., the Parent issue type and the child issue type.

Below is a print screen of the Behaviour configuration:-



I hope this helps to answer your question. :)

Thank you and Kind Regards,


Thank you @Ram Kumar Aravindakshan _Adaptavist_ I'll use this code.

Custom field A is a checkbox while custom field B and C are dropdown menus. But I think I understand what I need to do from this example. 

Thanks again!

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events