Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Need to Throw An Error When Expected Words Missing From Jira Text Field Edited

Hello Community, 

Can you please provide some ideas or maybe snippet of code to throw an error when users do not enter mandatory words in a Jira text field. 

Example: I have a text field, called "Action Plan". When a user creates a ticket and types words which do not include the same word "Notify" two times at the beginning and the end of the text field or in any orders, it will give them an error " Please include word "notify" at the start and the end of your action plan". I would like to make sure the same word needed to be mentioned twice in the same field. Should I use behavior or Automation in Jira?  Please advise. Thank you tons in advance for your help. 


2 answers

1 vote

You know you've made is as a community answerer when you are mentioned by name :)

Hi @Kay 

You can use either behavior with the setError("error text") method or use a workflow validator script.

The advantage of the behaviour is that it will run on edits as well as transitions.

The disadvantages of behavior are that if users make changes via the REST API, your validation will not take place and if they customize their view screen and hide the field, your validation will not take place.

Now if you are looking for how to check if the word 'notify' is present, regular expression is probably the way to go. But the exact expression will depend on how flexible you can be in the rule.

Here is a code snippet on how to test your text against an expression:

def text = """
notify some
text notify

def matcher = text =~ /(?si)^\s*notify.*notify\s*$/

This will return true/false if the string matches the pattern.

I'm really not all that good at regular expression. But you can test various options using regex101.

Here is the expression I used in the code above:

This will be true if the string starts with "notify" (excluding any preceding whitespace characters) and ends with notify with anything in between. If you want to allow other string at the end : notify{anythingelse}notify{anythingelse} then you can try this pattern:


Hello @Peter-Dave Sheehan

You have helped me before with very good answers and suggestion. If you have a chance, can you please take a look and help with this?


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

🤺 Atlympic Event: Partnerships

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

177 views 2 7
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