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

Validator to restrict spaces on custom field text

Jason Galea Aug 13, 2018

Hi,

 

I am trying to set up a validator on issue creation using "ScriptRunner for JIRA" to only allow a field to be filled in only if there are no 'Spaces'

Example: 

abc 123 < Incorrect

abc123 < Correct

 

Any suggestions please? 

Cheers,
Jason

1 answer

1 accepted

1 vote
Answer accepted
Bastian Stehmann [neusta portal services] Community Leader Aug 13, 2018

Hi @Jason Galea,

 

it should work if you get the field value as string and then check, for example with the contains-method, if there are any spaces within.

Roland Holban Aug 13, 2018

Use this as your validator condition:

!cfValues["FIELD_NAME"]?.value.contains(" ") 
Jason Galea Aug 27, 2018

It works. Thanks a lot @Roland Holban

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Jira

Try Jira Cloud for Outlook: Organize your work without leaving your inbox

Hi Atlassian community, My name is Max and I work on the product integration team at Atlassian. I am pleased to announce the early access program for the Jira Cloud add-in for Outlook. This add-in...

1,499 views 3 14
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