Hi, I'm trying to cobble together a validator script to check whether a checkbox field called New Hire Account Provisioning contains the value Egencia, at the same time checking to see if either of two custom fields is empty. If Egencia is checked and either or both of the two custom fields is empty, I want to throw up an error message. I've done this kind of thing before, and patterned this script off of the one that worked, but this one has the message "[Static type checking] - The variable [cfValues] is undeclared" on my if statement. Obviously cfValues isn't a variable, and I can't see why I'm getting this message. I'm sure I'm missing something obvious, so if you can see it, please help!
My script:
import com.atlassian.jira.issue.Issue
import com.opensymphony.workflow.InvalidInputException
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.component.ComponentAccessor
import org.apache.log4j.Category
def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cField = customFieldManager.getCustomFieldObject('customfield_15564')
log.error (cField)
def cFieldValue = issue.getCustomFieldValue(cField)
log.error (cFieldValue)
def cField2 = customFieldManager.getCustomFieldObject('customfield_16662')
log.error (cField2)
def cFieldValue2 = issue.getCustomFieldValue(cField2)
log.error (cFieldValue2)
if ((cfValues['New Hire Account provisioning']*.value.contains('Egencia')) && ((cFieldValue == null) || (cFieldValue2 == null)))
{
invalidInputException = new InvalidInputException("Manager Email", "Both Department Number and Manager Email are required when specifying an Egencia account be set up.")
}