Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Using JIRA CLOUD
The Cascading Select custom field consists of two drop-down lists. Currently in the 'required' mode of this field, only the existence of a value in the first drop-down is validated. In some scenarios this may be not enough. i want to set both parent and child option must be set in 'required' mode.
thanks,
Saravana Kumar
Jira Workflow Toolbox (JWT) offers a validator for making a field required, and it works for both levels of cascading select fields. GUI-configurable. No coding or scripting required.
Hi there,
Just in case this helps, (in Jira Cloud) I had a cascading field in a service desk request type - and wanted to make sure both parts of the cascading field were filled in.
The "Required" option takes care of the "parent" menu, but not the child.
You can't seem to validate it using any of the native validators as far as I can see - regular expression check won't even see cascading fields.
We do have ScriptRunner though - something I usually try to avoid (not because it's bad - it isn't - but if you're not used to scripting it's nice to avoid for myself or anyone taking over from me).
I tried various versions of "checking both parts were full" like this cfValues['your cascading field']?.values()*.value.size() == 2 with no luck,
Since I was only checking the child though, this worked:
issue.customfield_13997.child.value != ""
I tried earlier with 0 or NULL - that didn't work but I'm happy now.
Also in case anyone is wondering where it goes - if you have ScriptRunner, "ScriptRunner Script" appears in the validator options - and you just type it in as is. I'm not sure if you can put the real field name but the field ID can be obtained by editing the custom field and looking in the URL.
Just posting this in case anyone is looking again - and in case the underpinnings of Jira have changed a bit - this works at this point.
Scott
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
most previous answers were for Jira Server. On Jira Cloud, conditions and validators can only be written using Jira expressions, a language created by Atlassian.
You can use the Issue Fields help tab below the editor to find out how to test your cascading select field. It will be something like:
issue.customfield_12345 && issue.customfield_12345.child.value
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your response. Its working fine.
issue.customfield_12345 && issue.customfield_12345.child.value
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kaviraj,
Would you mind to share printscreen pointing where I should add this expression? I am pretty new to JIRA and kind of lost.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I kindly request your assistance with an additional requirement. I successfully implemented your expression in the Built-in script, and it's working well.
However, we now need to restrict this functionality to only certain request types. Specifically, if the request types are "General IT" or "Access Request," we would like both the parent and child fields for cascading to be mandatory.
Thank you in advance for your continued support.
Best regards,
Ajay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ajay Goud Gaddam ,
you can amend the expression this way:
!["General IT","Access Request"].includes(issue.issueType.name) || issue.customfield_12345 && issue.customfield_12345.child.value
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @David Fischer ,
I have amended the expression to match the Customer request types, like this
!["General IT","Access Request"].includes(issue.customfield_12400.requestType.name) || issue.customfield_24329 && issue.customfield_24329.child.value
But the child field was mandatory for all request types, not just for 2. Am I missing anything in the above expression? "||" refers to OR conditions, which might be the issue. I added "&&" between the customer request type and field value condition, but it did not work well.
fyi, Error message: Evaluation failed: "issue.customfield_12400.requestType" - Unrecognized property of `issue.customfield_12400`: "requestType" ('requestType'). Type null does not have any properties
We need L2 value mandatory if the Customer request form is "General IT" or "Access Request,"
Thanks again,
Ajay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
for some reason you replaced
issue.issueType.name
with
issue.customfield_12400.requestType.name
in your script. Please revert to
issue.issueType.name
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @David Fischer - Could you please share the screen shots if it possible, i have created the cascading field but in the validator expression that fiel is not showing up
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Anand R I'm not sure what screenshots you need. What do you mean by "i have created the cascading field but in the validator expression that field is not showing up"?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"Yes" does not answer my question...
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.
Hi Everyone
Using JMWE I have added required field validation with condition bellow statement is working for me
"!!issue.customfield_12345 && issue.customfield_12345.value == "Alert" && issue.customfield_12345.child.value == null"
please accept the answer if that works for you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kaviraj
It looks like there are significant differences between the on-prem and sever versions. I did a bit of browsing on the JMWE site and it looks like it uses a different process to get data. https://innovalog.atlassian.net/wiki/spaces/JMWEC/pages/108200055/User+created+custom+fields (Cascading section) Based on the accessing a field of cascading type, you may want to try something like this:
{{ issue.fields[
'Cascading field'
].child.value }} != null
or maybe
{{ issue.fields["Cascading field"] | field("child.value) }} != null
Unfortunately I don't have a cloud instance already configured to try this.
Bridy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bridy Frett
Thank you for your effort & response.
I have included below JIRA expression & its working fine.
issue.customfield_12345 && issue.customfield_12345.child.value
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Would you mind to share printscreen pointing where I should add this expression? I am pretty new to JIRA and kind of lost.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the workflow, on the Create transition, in the list of Validator options, you'll see an option called "Script Validator [ScriptRunner]"
Bridy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bridy Frett @Sreenivasaraju P
Using JIRA Cloud version.
Followed you steps from your comment, but didn't find the clue. I have ended up with the below page. kindly help me out to add
cfValues['your cascading field']?.values()*.value.size() == 2
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm afraid the Script Runner plug-in is required for that solution.
I did find also find a solution using Jira Misc Workflow Extensions, but that is another app and it doesn't look like you have it.
I don't believe it's possible with the core Jira logic.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bridy Frett
I have added Jira Misc Workflow to test it.
few validations are added.
Let me know the next step to make cascading field mandatory for second value.
Thanks a lot.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kaviraj
Use the "Linked issues Status Validator." In the groovy script field, enter the following:
issue.get("customfield_19900")?.get("1")?.optionId != null
Adjust your custom field ID as needed. get("1") refers the second field of the cascading list.
Bridy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bridy Frett
Thanks for your response
I have included above script with my Custom field ID.
But still i have an error when creating Issues even-though selected cascading second value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Based on the error, I think you are using the wrong validator. It's called "Scripted (Groovy) Validator (JMWE add-on)" on the validator page.
Here's a screenshot of my implementation:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear @Bridy Frett
Ya, I got your point.
This time i tried below mentioned Validator. (Refer Image 1)
Image 1
After that, added your script. (Refer Image 2)
Image 2
But Still i got error.
Error detail Snap below
It will be so helpful if you let me know where i went wrong.
Thanks
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.
how to add "Script Validator", i don't have option in script runner. Please share some steps to add "Script Validator"
where i have to add this line "cfValues['your cascading field']?.values()*.value.size() == 2"
i only having below options.
thanks,
Saravana Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
the validator below is working for us as well. Is it possible to make the validator for only one parent/child value in the cascade list? i.e. only for "option 1" in the parent list
!! issue.customfield_12345 && !! issue.customfield_12345.child.value
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.