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

Next challenges

Recent achievements


  • Give kudos
  • My kudos


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

How to make a custom field required when check box is checked?

I have a check box that if checked it needs to validate that a separate  custom field needs to contain data or the ticket cannot be closed. however if the check box is not checked the the custom field can remain empty.

2 answers

Hi Irshad
I'm afraid it is not possible with out-of-the-box Jira validators.
You should use something like Power Scripts For Jira to create a custom validator with if-else conditions.
Here is an example of script that could be helpful 



i tried the following and am getting an error:

string errorMsg = "Please enter Billing Instruction Number";
if (customfield_13500 == 1 && !hasInput("customfield_13600")) {
return false,"customfield_13600", errorMsg;

the comma after false is producing an error saying expecting } but got ,

I think there is some error in how you specifying custom fields and its value.
On my test instance it throws a different error and if i change fields to those i got on my instance and hit Check it says "Looks good"

Try to use this 

string errorMsg = "Please enter Billing Instruction Number";
if ("customfield_13500" == 1 && !hasInput("customfield_13600")) {
return false, "customfield_13600", errorMsg;

Also you should open any issue that contains those fields with JSON representation and check if field names and value you specifying are correct.

For JSON representation

https://<your jira URL>/rest/api/2/issue/<issuekey>?expand=names

would it matter that im using script runner and not power scripts??

Yes. Power Scripts using Simple Issue Language and ScriptRunner is using Groovy. Scripts from Power Scripts not compatible with ScriptRunner. 

With Power Scripts its much more easy to start, but ScriptRunner is more powerful in some cases.

For this case i rather use Power Scripts then Script Runner, but if you more familiar with groovy then Script Runner will probably be better. 

so we use Script runner, guess i need to start from scratch now, apologies for not highlighting this from the start

No problem.
If you get stuck with Script Runner, feel free to raise support request on vendor's service desk.

0 votes
Tarun Sapra Community Leader Apr 11, 2019

Hello @Irshad Sheik 

It's not possible out of the box, I have implemented something similar using the Behvaiour module of the Script runner paid plugin.

Possible duplicate

Tarun Sapra Community Leader Apr 12, 2019

Hello @Irshad Sheik 

Have you gone through the link which I have shared above as it contains a pretty similar code snippet which is required in your scenario.

i have gone thru the link, but im still struggling on this, ive gotten so far:

def checkBoxField = getFieldByID()
def checkBoxFieldVal = checkBoxField.getValue()
def BI = getFieldByName('Billing Instruction')

if (checkBoxFieldVal == 1){


not sure if im on the right path or whats left.

Suggest an answer

Log in or Sign up to answer
Community showcase
Asked in Jira Service Desk

Calling all Insight users, we need your help!

Hello Insight users,  As part of our (Mindville's) acquisition by Atlassian, our training team is looking to build some new Insight training materials. It would really helpful if you can ...

231 views 3 5
View question

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