Hi All, I have a requirement to mandate the Attachments field, upon a certain Drop-Down field selection. The code I current have does not seem to work. Any suggestions welcome!
import com.atlassian.jira.component.ComponentAccessor
// Get the field objects
def dropdownField = customFieldManager.getCustomFieldObject("customfield_23803") //
def attachmentField = getFieldById ("Attachment") //
// Get the value selected in the dropdown
def dropdownValue = dropdownField.getValue()
// Specify the options that should make the attachment field mandatory
def mandatoryOptions = ["Encrypted Email", "ForumPass"] // List of all options that make the attachment mandatory
// Check if the selected value is in the list of mandatory options
if (mandatoryOptions.contains(dropdownValue)) {
attachmentField.setRequired(true)
} else {
attachmentField.setRequired(false)
}