Our new Appfire Documentation Space is now live!
Take a look here! If you have any questions please email support@appfire.com
Validate cascading field - The parent option is mandatory and the child option, if exists, is required.
This article provides the code snippet to validate a Cascading field - The parent option is mandatory and the child option, if exists, is required
using Scripted (Groovy) Validator (JMWE app) validator.
Instructions
Navigate to the intended workflow to make the necessary changes in the edit mode.
Select the required transition.
Select the Validators tab and click
Add validator
.Add the “Scripted (Groovy) Validator (JMWE app)” validator
Add the below Groovy script:
def parentId = issue.get("customfield_11601")?.get(null)?.optionId if(!parentId) return false def childOptions = issue.getAvailableOptions("customfield_11601").rootOptions.find{it.optionId == parentId}?.childOptions if(childOptions) return !!issue.get("customfield_11601")?.get("1")?.value return true
Replace 11601
with the id of the cascading field.