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

MAKE THE CHILD VALUE OF CASCADE FIELD REQUIRED

IDO GAFSON June 29, 2023

i am trying to make the child value of cascade field mandatory and 
and i inherit the values from the epic.

 

 i do the check for the size of the cascading field its look like he run twice 
once i get size = 2 an its good because he run to the right if function 
but after he finish
i see there second run and this time the size = 1 
and then i get the error that the fied is not filled
important to say 
1) i see both cascading whit value
2) if i change value i saw the validation run only once and its fix

 

 

if (mapVal.size() ==1)

{cf.setError("not good")}

else{cf.clearError()}

if (mapVal.size() >1)

{..... }

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
2 votes
Answer accepted
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 3, 2023

Hi @IDO GAFSON

It's not possible to directly set the Child List in the Cascading List to required using ScriptRunner's Behaviour.

However, you can add an error message Cascading List which will function like a validator to ensure that the Child List's value is set before the issue can be created.

Below is a sample working code for your reference:-

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

@BaseScript FieldBehaviours behaviours
def cascade = getFieldById(fieldChanged)
def cascadeValue = cascade.value as List
cascade.required = true
cascade.clearError()

if (cascadeValue.size() < 2) {
cascade.setError('Child List Must Be Selected')
}

Please note that the working sample 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:-

behaviour_config.png

Below are a couple of test screenshots for your reference:-

1. When the Creat dialog is first loaded, the Cascading List will return an error message as no value has been set, as shown in the image below:-

test1.png

2. If only the parent value of the Cascading List is selected, as expected, the error message will not be removed as shown in the screenshot below:-

test2.png

3. Only once the parent and child list options are selected from the Cascading List, will the error message be removed as shown in the screenshot below:-

test3.png

I hope this helps to solve your question. :-)

Thank you and Kind regards,
Ram

Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 6, 2023

Hi @IDO GAFSON

Has your question been answered?

If yes, please accept the answer.

Thank you and Kind regards,

Ram

Like mete likes this
IDO GAFSON July 12, 2023

it's solve half of my problem
If i create a new story its work fine 

but if I create story from epic the cascad field inharit the values from the linked epic 

and then the story get the valus and filld the field but i get the error that the child not filld until i change him to somting else

Alex
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 30, 2024

@Ram Kumar Aravindakshan _Adaptavist_ 
Hi!
Thank you for answer !
It's helpful!

TAGS
AUG Leaders

Atlassian Community Events