Simple scripted validator - "OR"

Sales_Ops August 20, 2019

I'm using Adaptavist Simple Scripted Validator to check the below on create:

 

A). I have a field "Global" - if a user fills it in as Yes, I want them to be required to fill out field "Users"

B). If a user fills in global = no, they have to fill out one of either Users, User Types, or Dataset. 

 

I have the script for A (below). How do I add in the script for B? Basically I want an either/or statement

 

cfValues['Global']?.value != 'Yes' || cfValues['Users']

2 answers

1 accepted

0 votes
Answer accepted
Ilya Turov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 20, 2019

I think you can achieve it using a single validator:

(cfValues['Global']?.value == 'Yes' && cfValues['Users']) || (cfValues['Global']?.value == 'No' && (cfValues['Users'] || cfValues['User Types'] || cfValues['Dataset']))

looks like a lot of brackets, but basically first part is condition A, second - B

Sales_Ops August 21, 2019

Thank  you!

0 votes
jira guy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 20, 2019

Use script-runner behaviors to achieve this. You don't need to write any groovy for this.  

 

https://scriptrunner.adaptavist.com/latest/jira/behaviours-overview.html

 

  • Making a field mandatory depending on other data entered on the issue screen (i.e during an issue creation or an issue transition)

Suggest an answer

Log in or Sign up to answer