With Adaptavist Scriptrunner or MyGroovy plugins for Jira Server and a little groovy script we can validate/require or make mandatory the second drop down of a cascading field.
Just create a Simple scripted validator in the transition! Example:
cfValues["The name of your customfield"]?.keySet()?.size() == 2
Very easy!
Example:
By MrAddon
MyGroovy:
Maybe I complicate it, but I not found easier solution than this:
import com.opensymphony.workflow.InvalidInputException
import com.atlassian.jira.component.ComponentAccessor
if (issue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObject(“customfield_XXXX”))?.keySet()?.size() == 2) {
return true
} else {
throw new InvalidInputException(“error message”)
}
LikeLiked by 1 person
Thanks Maks!
LikeLike
Hi MrAddon,
How to reqired in create issue wih behaviours?
Thanks
LikeLike
Hello Nihat,
Here an example of validation with Behaviours
LikeLike
Hi MrAddon,
I think, I couldn’t explain. But, very important to your examle for me.
I have a custom field (cascading select list). If creating new issue, I want to required second field (child) on cascading filed
Thanks
LikeLike
You can use simple script validators or more complex script validators
Example:
Regards
LikeLike
You can use simple script validators or more complex script validators
Example:
Regards
LikeLike
Thans MrAddon for support. It don’t work in behaviours.
LikeLike
Hi MrAddon,
There are two issue type. “ABC” issue type using “cascading1” custom field and “XYZ” issue type using “cascading2” custom field. I want to make mandatory custom field according the issue type.
Thanks.
LikeLike
Easy! Is a simple script behaviour with ScriptRunner
LikeLike