Make due date required based on another custom field's value

Hi I have a custom field which is a drop down menu(single select) with two options 'A' and 'B'. If I select A due date should be required otherwise not.

I am using the following code as a server side validation using Behaviours plugin


import org.apache.log4j.Category

import com.onresolve.jira.groovy.user.FieldBehaviours

import com.onresolve.jira.groovy.user.FormField

import com.atlassian.jira.issue.Issue

def Category log = Category.getInstance("com.onresolve.jira.groovy.postfunction");

log.warn("Test log statement"+getFieldByName("duedate"));

log.warn("Finished logging ---"+getFieldByName("End User").getValue()+" ------");

if(getFieldByName("End User").getValue() == "A")




There is nothing on my JIRA logs and the script does not work. Please suggest something to make it work


1 answer

This widget could not be displayed.



But note you have nothing that sets the due date back to not required, if the user changes from option A to something else.

So remove your "if" block and use:

getFieldById("duedate").setRequired(getFieldByName("End User").getValue() == "A")

Hi Jamie,

Thanks for the reply. I made the changes but it still does not work.
Note: This is for the entire workflow so do I need to put any conditions or adding no conditions implies across the entire worklfow.


You've written this as a behaviours script. That's the bestway to do this, although it could also be done as a validator.

Can you send a screenshot of the config.

Hi Jamie,

I am attaching a screenshot as you requested.

I don't see a screenshot...

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

54 views 1 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you