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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,414,336
Community Members
 
Community Events
170
Community Groups

How to make both fields required in Cascading Select field

 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

6 answers

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.

1 vote

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

Hi @David Fischer _Appfire_ 

Thanks for your response. Its working fine.

issue.customfield_12345 && issue.customfield_12345.child.value

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.

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.

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

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

Hi @Bridy Frett @Bridy Frett

Would you mind to share printscreen pointing where I should add this expression? I am pretty new to JIRA and kind of lost.

Hi @SARAVANAKUMAR 

In the workflow, on the Create transition, in the list of Validator options, you'll see an option called "Script Validator [ScriptRunner]"

Bridy

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

 

Workflow validation.PNG

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.

Like Rodrigo Mieres likes this

Hi @Bridy Frett 

I have added Jira Misc Workflow to test it.

few validations are added. 

Workflow validation 02.PNG

Let me know the next step to make cascading field mandatory for second value.

Thanks a lot.

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

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.

Workflow validation 03.PNG

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:

cascade field.png

Dear @Bridy Frett 

Ya, I got your point.

This time i tried below mentioned Validator. (Refer Image 1)

Image 1

Workflow validation 04.PNG

After that, added your script. (Refer Image 2)

Image 2

Scripted 01.PNGBut Still i got error.

Validator 01.PNG

Error detail Snap below

Error Detail 01.PNG

It will be so helpful if you let me know where i went wrong.

 

Thanks

Hi @Sreenivasaraju P 

   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.

script runner.png

thanks,

Saravana Kumar 

Hi @David Fischer _Appfire_  

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

 

Please discard my question

Suggest an answer

Log in or Sign up to answer