Missed Team ’24? Catch up on announcements here.

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

Helper Text on Cascading Field using Behaviour

Silu patra
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 30, 2023

Hi,

 

I was working on a script to display helper text on a cascading field based on values selected in the Parent and Child Option.

Below is the script I am using however it doesn't seem to be working. Inputs would be helpful.

 

import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()

@BaseScript FieldBehaviours fieldBehaviours

//get the custom field details
def customField = getFieldByName("Root Cause (new)")
//get the cascade field value
//def cfAValue = customField.value as List

//for debug purpose
//log.warn "cfAValue: " + cfAValue

if (cfAValue) {

//Size at least 2 [parentValue, childValue]
if (cfAValue.size()>1) {
//The 1st value will be your parent value, and the 2nd value will be your child value:
def parentValue = cfAValue.get(0)
def childValue = cfAValue.get(1)

//For debug purpose
//log.warn "cfAValue: ${cfAValue}"
//log.warn "parentValue: ${parentValue}"
//log.warn "childValue: ${childValue}"

if(parentValue.toString().contains("Data Issue")  && childValue == "Coding Error"){
customField.setDescription("Test")
} else {
customField.setDescription(null)
}
}
}

 

Thanks

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events