Hi community!
I have field "Field_1" and "Field_2". I want to during the selection Field_1 and value "BR" could choose only K3 value in Field_2. If the values are selected incorrectly then display an error.
I set script validator in create issue.
My code:
import com.atlassian.jira.component.ComponentAccessor
import com.opensymphony.workflow.InvalidInputException
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def field_1 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("cf1")
def field_2 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("cf2")
def field_1_value = issue.getCustomFieldValue(field_1)
def field_2_value = issue.getCustomFieldValue(field_2)
if (field_1_value == "BR" && field_2_value != "К3") {
throw new InvalidInputException("You must pick only K3 value")
}
This script work but the log is empty and condition not run.
I need to get an error in case of a wrong choice.
What i do wrong?
Best Regards,
Alexander