You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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?
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 (issueContext.issueType.name != '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,
Ram
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.