Hi There,
Here is the behavior script I'm creating
script would look like this for now:
def sourcefield = getFieldById("duedate")
def targetField = getFieldByName("XYZ")
targetField.setRequired(false)
if (sourcefield.getValue()){
targetField.setRequired(true)
} else {
targetField.setRequired(false)
}
The field "Due Date" is a system field and there was a bug (SRJIRA-2758) where you can't get a system field form field by its name. You have to get by its ID instead:
def sourcefield = getFieldById("duedate")However, it was fixed in ScriptRunner 6.19.0. I highly recommend for you to upgrade as there are a quite number of bugs that have been fixed from 6.12.0.
Regards, Eswar