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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to write validation for a particular field value change

I want to throw an error message on the screen on the change of a checkbox field. SO initially we are writing a JQL query to fetch the results and if results are greater than 1, and if user is trying to check a checkbox field..I should be throwing error.

We have used JWT validators for JQL query but it is stopping us from updating any field on the screen.

SO is there any way to restrict error message only a particular field

2 answers

1 accepted

0 votes
Answer accepted

With Scriptrunner behavior, you can display a red error message just below the checkbox field as soon as the checkbox is clicked.

The tricky thing may be to decide how this script should behave (if at all) when an issue where it was previously checked is opened and the JQL query results now have a value.

If you only need this to run upon issue creation it is simple:

//only run on create (issue doesn't yet exist in the db)
def chkFld = getFieldById(getFieldChanged())
//normalize the checkbox value... behavior returns astring when single box is checked or array when you have more than 1
def checkBoxValue = (chkFld.value instanceof String) ? [chkFld.value] : chkFld.value
chkFld.clearError() //("Security was NOT checked")
if(checkBoxValue.any{it == 'LabelOfYourCheckbox'}){
//do your JQL search here
def resultCount = 1
chkFld.setError("JQL returned more than 1 result")

Hi everyone,

just adding the solution we came up with in the support ticket here in case someone else having a similar question.

The scenario of interest describes as follows: when selecting the option Yes on a select custom field Final Review, check whether there already are other issues with that option. If so, block the transition, if not, pass.

We were finally able to do so given the following expression:

%{15562} = "Yes" IMPLIES count(issuesFromJQL("project = 'SW Build Project' AND issuetype = 'Internal Build' AND 'Final Build' = 'Yes' AND 'Target SW Release' = '" + %{15484} + "' AND key != '" + %{00015} + "'")) = 0

The first part is the initial check of the Final Review field which means, the expression is always true, when the selected option is not Yes.

%{15562} = "Yes" 

The second clause states that if the option Yes is selected, the given query must return 0 results, meaning there must be no other issue with this option.


Suggest an answer

Log in or Sign up to answer

Atlassian Community Events