How to set checkbox options mandatory depending on another field value?

Hi everybody,

Is it possible to set multiple options mandatory in a checkbox field depending on another field value?

For example, I have a checkbox field and a select list field

Select list field has the following options. Only one option can be selected.

  • A
  • B
  • C
  • D
  • E

Checkbox field has the following options. Multiple options can be selected.

  • F
  • G
  • H
  • I
  • J
  • K
  • M

If "B" is selected from select list field, can we put H, I, J, K as mandatory options when JIRA workflow transits to another status?

I'll appreciate if you have any suggestions.

 

 

2 answers

I'm new to JIRA development, but in the past, the developers of my current project did something similar to this using a custom 'validator' plug-in, which was added to any workflow transitions on which it should be enforced.  I'm not sure if this is the best (or only?) approach, but it did work.  Note: this won't mark the field as 'mandatory' (with *), but does cause the transition to fail, and gives the user whatever custom feedback you want...

Hi Wendy,

Thanks. We are using the workflow validator plugin that can cause transition to fail based on predefined condition/validator. Do you know what condition/script should be configured to implement the example use case I described?

 

Well, when I said 'custom' validator, I mean one our team wrote 'from scratch'.  Not a huge deal, just...:

Velocity templates (edit, input, view),

2 Java classes (one that implements com.opensymphony.workflow.Validator and the other extends AbstractWorkflowPluginFactory and implements WorkflowPluginValidatorFactory, both from the com.atlassian.jira.plugin.workflow package), 

and an atlassian-plugin.xml file (not 'in a pear tree...' ;-} LOL) 

Some 'MyXyzValidator' holds a CustomFieldManager variable (passed into constructor) to get contents of custom fields, but the conditional logic is in the 'validate' method, wherein you can structure tests on whatever values you want, and if the test(s) fail(s), you throw an InvalidInputException (containing any error message you want to show the user).  The plugin XML file must specify the validator class and templates, and the plugin must be compiled/packaged, and then installed by the JIRA administrator. THEN the custom validator must be added to a workflow transition to execute.

There are tutorials that do a much better, more complete job of explaining this (I don't have the URL handy, but they are easy to find), so good luck!

 

 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

89 views 0 5
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