Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Validator - Booleen expression question

steve.collins August 12, 2020

Hello,

I need help in creating a Booleen expression for a Field Validator to 

1. Allow the user to enter nothing

2. If the user enters a value, that value needs to be numeric characters and 6 characters in length

Thanks

 

1 answer

0 votes
brbojorque
Community Champion
August 12, 2020

Hi @steve.collins , I have tried to do this in a vanilla Jira cloud instance and it is not doable, because the premise of the out-of-the-box validator is it has to have a value and then extra checks depending on the type of validator you want.

What I can suggest is to use JMWE for Cloud and look for Scripted validator.

  • #1 is easy just make sure it is empty and return false 
  • #2 use regex like so [0-9]{6} 

Refer to this doc.

https://innovalog.atlassian.net/wiki/spaces/JMWEC/pages/935362565/Build-your-own+scripted+Validator

steve.collins August 12, 2020

Thanks 

I was hoping I could add the expression something like [0-9]{6}^null

in other words the field could be 6 digits long OR not entered

What would be the correct expression for this ?

Steve

brbojorque
Community Champion
August 12, 2020

Hi @steve.collins ,

Aha!, it's definitely doable but you have to find the right regex for it.

Something similar to this.

https://stackoverflow.com/questions/5063977/regex-empty-string-or-email

brbojorque
Community Champion
August 12, 2020

Maybe, I'll test this later.

(^$|[0-9]{6}$)
steve.collins August 12, 2020

Thanks so much !! It works, cheers Steve

Like brbojorque likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events