Test if Component/s is empty with Groovy script

Hi all,

I am creating a transition validator with the Script Runner that shall work like this:

  • If the checkbox "Quick Ticket" is cleared it shall allow the create transition at all times
  • If the checkbox is set it shall only allow the transition if there is (at least) one value set for Component/s
  • The field Component/s shall only be mandatory in this case

I have come up with the following condition in the scripted validator but I can't get the Component/s validation to work :-(

cfValues['Quick Ticket'] == null || (cfValues['Quick Ticket'] != null && issue.components != null)

It is probably really simple but I cannot figure the syntax out here.

Any suggestions are highly appreciated.

Cheers,

// Svante

2 answers

1 accepted

This widget could not be displayed.

I think the components part should be like the following

issue.getComponentObjects().size() != 0

Hope that works

Yep, that did the trick!

Great, thnx!

Cheers,

// Svante

This widget could not be displayed.

I want to check if Comment is empty along with other custom with Groovy script. Please help.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

139 views 2 0
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you