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.

Attachment mandatory & non mandatory based on variable condition

ShrutikaD
Tera Contributor

Hi 

I want to make attachment mandatory based on condition which is working fine.(on portal)

here is the code

var mode = g_form.getValue('mode');
 
   if((mode == 'eft')&&(this.document.getElementsByClassName('get-attachment').length == 0))  {
                g_form.addErrorMessage('Please attach required file/s');
                return false;
}
I need to add one more combination to this condition when mode==eft && id ==yes  then attachment should NOT be mandatory.
please suggest how to achieve this
0 REPLIES 0