The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

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
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events