While Issue creation, if the value of a field "Source of change request" = Customer then the field "External Issue ID" should be made mandatory. I tried with behaviours and listens too in Scriptrunner but its getting mandatory field option while submitting state .But i need to get it while creation of issue.

import com.atlassian.jira.component.ComponentAccessor // Get the custom field manager def customFieldManager = ComponentAccessor.getCustomFieldManager() // Get the fields by name def sourceOfChangeRequestField = getFieldByName("Source of Change Request") def externalIssueIdField = getFieldByName("External Issue Id") // Get the current value of "Source of Change Request" def sourceOfChangeRequestValue = sourceOfChangeRequestField.getValue() as String // Check if the "Source of Change Request" is set to "Customer" if (sourceOfChangeRequestValue == "Customer") { // If "External Issue Id" is empty, show an error and prevent submission if (!externalIssueIdField.getValue() || externalIssueIdField.getValue().toString().trim().isEmpty()) { externalIssueIdField.setError("External Issue Id is required when 'Source of Change Request' is set to 'Customer'.") } else { // Clear the error if the field is filled externalIssueIdField.clearError() } } else { // Clear any existing error if "Source of Change Request" is not "Customer" externalIssueIdField.clearError() }