Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

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

JerryJ071847183
Tera Sage

I think something similar has been done in the below 

 

LINK

 

I hope this information helps.

Anand Kumar P
Tera 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