Check Value of a Custom Field
Following script checks value of a custom field named “Single Line Text” and if it’s value is null it prohibits logging work to issue.
import com.atlassian.jira.component.*;
import com.atlassian.jira.issue.*;
import com.atlassian.jira.issue.fields.*;
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cfValue = worklog.issue.getCustomFieldValue(customFieldManager.getCustomFieldObjectByName("Single Line Text"))
if (cfValue == null) {
return "You have to provide a value for 'Single Line Text' custom field."
}