Forums

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

Field validation to allow integers only without mandatory field

Lakshmi CH
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.
May 12, 2023 edited

Hi Team,

We would like to validate the numeric value like 50000 or 201203, etc on the single-line text field. I tried to use a "Simple scripted validator" in workflow validator and applied the below condition. It's working, but we do not want this field as mandatory. It's validating the field, but it's not allowing to create of the ticket without entering the value. Is there any option to make this field validation without mandatory?

cfValues['Cost at Approval'] ==~ /^[0-9]*$/

 

2 answers

1 accepted

1 vote
Answer accepted
David Fischer
Community Champion
May 12, 2023

Hi @Lakshmi CH ,

Using JMWE's Scripted Validator, you can use this script:

!issue.get("Cost at Approval") || issue.get("Cost at Approval") ==~ /^\d+$/
Lakshmi CH
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.
May 15, 2023

Thank you @David Fischer Its working as expected.

0 votes
Karim ABO HASHISH
Community Champion
May 12, 2023

hi @Lakshmi CH 

could you please try with this expression 

/^[0-9]{0-n}$/

it allows for empty value.

it should normally work on Cloud version but I didn't test it on the server version.

Let me know how it went for you.

Cheers,

Karim

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, confluence, loom, atlassian intelligence, ai notes, ai-powered meeting notes, atlassian community events, ace, confluence ai, loom ai integration, ai note-taking, atlassian ai features, team '25, atlassian live learning, confluence automation

Unlock AI-powered meeting notes: Join our live learning session! 📹

Did you catch the news at Team ‘25? With Loom, Confluence, Atlassian Intelligence, & even Jira 👀, you won’t have to worry about taking meeting notes again… unless you want to. Join us to explore the beta & discover a new way to boost meeting productivity.

Register today!
AUG Leaders

Atlassian Community Events