Hi,
I wrote a script in the behavior environment for a cascade list field
The beginning of the code:
-------------
import com.atlassian.jira.component.ComponentAccessor
But the script is executed only when both field values change (the Parent and the Child)
Is there a solution for the script to execute even when only the Parent value of the field changes?
Can anyone help me?
Regards,
Shoshi
If you want to trigger the Behaviour when the Parent option of the Cascading List is selected, you can use the approach shown in the sample working code below:-
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours behaviours
def sampleCascade = getFieldById(fieldChanged)
def sampleCascadeValue = sampleCascade.value
def sampleText = getFieldByName('Sample Text')
sampleText.formValue = ''
if (sampleCascadeValue == ['Option 1']) {
sampleText.setFormValue("Option 1 Selected")
} else if (sampleCascadeValue == ['Option 2']) {
sampleText.setFormValue("Option 2 Selected")
} else if (sampleCascadeValue == ['Option 3']) {
sampleText.setFormValue("Option 3 Selected")
}
Please note that the sample working code above is not 100% exact to your environment. Hence, you will need to make the required modifications.
Below is a screenshot of the Server-Side Behaviour configuration:-
Below are a couple of test screenshots for your reference:-
1. When the Create Issue dialog first loads, no option from the Cascading List is selected. Hence, as expected, the Sample Text Field is not updated either.
2. If Option 1 is selected from the Parent option of the Cascading Select List, the value in the Text Field is set to Option 1 Selected, as shown below.
3. If Option 2 is selected from the Parent option of the Cascading Select List, the value in the Text Field is set to Option 2 Selected, as shown below.
4. If Option 1 is selected from the Parent option of the Cascading Select List, the value in the Text Field is set to Option 3 Selected, as shown below.
I hope this helps to solve your question. :-)
Thank you and Kind regards,
Ram
Has your question been answered?
If yes, kindly accept the answer.
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hן @Ram Kumar Aravindakshan _Adaptavist_
I apologize for the late reply
I was on an unexpected vacation
Your solution helped me a lot
Thank you
Regards
Shoshana
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.