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



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'


abc 123 < Incorrect

abc123 < Correct


Any suggestions please? 


1 answer

1 accepted

1 vote
Answer accepted

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.

Use this as your validator condition:

!cfValues["FIELD_NAME"]?.value.contains(" ") 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

Managing Incidents - The roof is on FIRE!

The roof is on FIRE… network outages, broken processes, upset clients and employees. Each day seemed to bring more and more issues. Incidents were communicated via email, messengers (skype or teams) ...

122 views 0 1
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