Hi Team,
We have two custom fields in a projects.
Custom Field 1 is single line text type
Custom Field 2 is date type
Now here is the requirement, If data entered in CF1 the CF2 should be a mandatory field.
If CF1 has nothing in it then CF2 is not mandatory. Can we do this while creating and editing issues?
Appreciate if someone has a sample code using Scriptrunner/ behavior.
JIRA version 7.12.3
TIA!!
Hi Ash,
This script should work for you. You'll just need to change the names of your custom fields. This goes in a Behaviour on the Single Line Text Field.
def singleText = getFieldByName("TextFieldA")
def dateField = getFieldByName("First DateTime")
if (singleText.getValue() == "") {
dateField.setRequired(true)
} else {
dateField.setRequired(false)
}
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.