Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

JMWE - JSM Cascading Form Field

Julian Governale
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 22, 2024

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.

1 answer

0 votes
Salih Tuç
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 24, 2024

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

 

Julian Governale
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 25, 2024

Thanks, unfortunately, even with checking the value of the field, it can still be created without it being populated. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events