It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

4 answers

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 @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.

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 @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
0 votes

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__Innovalog_ 

Thanks for your response. Its working fine.

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

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you