Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Make variable mandatory on catalog based on MVRS

pramodkumar
Tera Expert

Hi All,

We have a requirement to show a attachment variable and make mandatory on catalog form based on a variable on MVRS. How can we achieve this? I have tried on submit client script, but it did not work

 

Thanks!

2 REPLIES 2

Ct111
Tera Sage

I think something similar has been done in the below 

 

LINK

 

I hope this information helps.

Anand Kumar P
Giga Patron

Hi @pramodkumar ,

Use below script,

function onSubmit() {
        if((g_form.getValue('<variable name>') == 'yes') && this.document.getElementsByClassName('get-attachment').length == 0) {
               g_form.addErrorMessage(getMessage('attachment_is_mandatory'));
               return false;
        }      
}

 

If my response helped, please mark it as the accepted solution and give a thumbs up👍.
Thanks,
Anand