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)
{..... }
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:-
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:-
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:-
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:-
I hope this helps to solve your question. :-)
Thank you and Kind regards,
Ram
Hi @IDO GAFSON
Has your question been answered?
If yes, please 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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Ram Kumar Aravindakshan _Adaptavist_
Hi!
Thank you for answer !
It's helpful!
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.