With the new cascading field's option in JSM forms, has anyone been able to get the child value enforced through add-ons like JMWE?
Ive tried the following using the "build your script" option & JMWE Field Required Validator. We have a few request types that use the same issue type so trying to isolate the validation to just that request type.
Cascading Field ID: customfield_10958 | customfield_10958.child
!!issue.customfield_10200 && issue.customfield_10200.requestType.name == "Promo Request" && !!issue.customfield_10958 && ! issue.customfield_10958.child
The goal is to check and throw an error when the Child Value is empty on form submission.
Hi @Julian Governale ,
For the child option, I would continue with checking its value:
!issue.customfield_10958.child.value
In Cloud, these scripts are working depend on the relationship in REST API response. So, for cascading fields, it is coming as:
"customfield_xxxxx"
:
{
"self"
:String,
//URL of the parent of the cascading custom field.
"value"
:String,
//Value of the parent of the cascading custom field.
"id"
:String,
//ID of the custom field.
"child"
:
{
"self"
:String,
//URL of the child of the cascading custom field.
"value"
:String,
//Value of the child of the cascading custom field.
"id"
:String
//ID of the child of the cascading custom field.
}
},
So, if the child is empty, probably it is returning as an empty object. Thus, if you check the value directly, it may be meaningful. Or, just in case, you can check both:
(!issue.customfield_10958.child && !issue.customfield_10958.child.value
Thanks, unfortunately, even with checking the value of the field, it can still be created without it being populated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.