Dear Friends,
I have a cascading select list field
in my project and when i make it mandatory in the field configuration only the 1st value is verified by JIRA. The 2nd value can be empty. It seems to be default behavior for this type of custom fields.
However, i need to go further and enforce that 2nd value is also mandatory. I managed to do this on Create screen by using ScriptRunner script validator in workflow. And it works fine on the Create screen, this is the code I wrote:
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.fields.CustomField;
import org.apache.log4j.Level
import org.apache.log4j.Logger
//def log = Logger.getLogger("com.acme.workflows")
//log.setLevel(Level.DEBUG)
CustomFieldManager cfm = ComponentAccessor.getCustomFieldManager();
CustomField parentField = cfm.getCustomFieldObject("customfield_11000");
def cascadingListValue = issue.getCustomFieldValue(parentField) as Map
if(cascadingListValue != null){
String parent = cascadingListValue.get(null);
String child = cascadingListValue.get("1");
//log.info("Parent:" + parent);
//log.info("Child: " + child);
return ((parent != null) && (child != null));
} else
return false;
However, the challenge here is with the Edit screen. The Edit action is not associated with any transition, like Create action, and I am not sure if there is any way to force jira to validate that 2nd value is mandatory. Tried to do something with Behaviour but so far no progress here.
If you have any ideas how to achieve this, please let me know. Any thoughts are welcome.
Thank you,