Validator rule help: if a checkbox is selected, a textbox must have a value

Hi,

I'm trying to impose a workflow validator rule: if any checkboxes within one custom field are chosen, then a related textbox must have a value.

After much searching, I concluded there doesn't seem to be a built-in or extended workflow validator for checkboxes (we have Workflow Toolbox, JIRA Misc Workflow Extensions, Workflow Essentials for JIRA, Workflow Enhancer for JIRA, Workflow PowerBox). So tried my hand at building a Groovy script validator, not really understanding Groovy script. I finally added the following rule, which at least makes sense to me:

import com.atlassian.jira.component.ComponentAccessor

if(
(cfValues['Production QA']*.value.contains("Coverpage") || cfValues['Production QA']*.value.contains("BRF") || cfValues['Production QA']*.value.contains("Tactile") || cfValues['Production QA']*.value.contains("Shipping") || cfValues['Production QA']*.value.contains("Miscellaneous")) )
{ cfValues['Production QA Comments'] !="" }

The goal is that if the checkboxes have any of the values above, then the Comments field must as well. I figured this was a good start, but every time I try to test it I get:

An unknown exception occured executing Validator com.atlassian.jira.workflow.SkippableValidator@1871d19d: root cause: No such property: cfValues for class: Script1

So despite the Groovy documentation saying that cfValues['<field>']*.value.contains ("[value]") was the way to go, something essential is missing. Any suggestions?

0 answers

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Apr 10, 2018 in Marketplace Apps

Learn about how Stefan K. built one of the *first ever* Marketplace apps

In this post you will discover more about the evolution of K15t software, some big topics they're currently focusing on in the app space, and a rare (not not funny!) photo of founders Mike Cannon-Bro...

12,641 views 11 24
Read article

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