Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements


  • Give kudos
  • My kudos


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Simple Scripted Validator - "OR" Edited

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']

1 comment

You could try something like this:

if(cfValues['Global']?.value == 'Yes'){
return (cfValues['Users'])
} else {
return cfValues['Users'] || cfValues['User Types'] || cfValues['Dataset']

 Or you could use a custom validator instead and target the error message based on the condition (cfValues is not available, so you'll need some code to read those values):

import com.atlassian.jira.component.ComponentAccessor
import com.opensymphony.workflow.InvalidInputException
def cfm = ComponentAccessor.customFieldManager

def globalCf = cfm.getCustomFieldObjectByName('Global')
def usersCf= cfm.getCustomFieldObjectByName('Users')
def userTypesCf= cfm.getCustomFieldObjectByName('User Types')
def datasetCf= cfm.getCustomFieldObjectByName('Dataset')

def globalVal = issue.getCustomFieldValue(globalCf)?.value
def usersVal = issue.getCustomFieldValue(usersCf)
def userTypesVal= issue.getCustomFieldValue(userTypesCf)
def datasetVal = issue.getCustomFieldValue(datasetCf)

if(globalVal == 'Yes' && !usersVal){
throw new InvalidInputException(usersCf.hiddenFieldId, "This field is required when Global = Yes")

if(globalVal == 'No' && !usersVal && !userTypesVal && !datasetVal ) {
throw new InvalidInputException(globalCf.hiddenFieldId, "When you select No, you must complete either 'Users', 'User Types' or 'Dataset'")


Come to think of it.. it might be easier to have 2 separate simple scripted validation configurations and target the message that way.. 


Log in or Sign up to comment
Community showcase
Published in Jira Software

How to create Jira issus from Excel file?

When to use CSV importer When managing your processes in Jira, there are many occasions where you need to create a lot of tasks. Creating them one by one will cost you a lot of time and effort and i...

4,608 views 22 33
Read article

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