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.

Issue with the OnSubmit client script

Pooja Khatri
Tera Contributor

Hi All,

 

I have the below OnSubmit client script written for making attachments as mandatory 

 

Script ::

 

function onSubmit() {
if(this.document.getElementsByClassName('get-attachment').length == 0 && g_form.getValue('do_you_have_a_copy_of_the_rfx')=="Yes"  ) {
           alert('Please attach the copy of the RFX.');
           return false;
           }
}
 
The script is working in the main form but it is giving me the error on the main RITM , whenever I click on the ""Cancel Request"
 
Error : 
 
PoojaKhatri_0-1715866466672.png

 

 

How can I fix this issue ?

5 REPLIES 5

@Pooja Khatri  This is what i tried on my PDI and its working fine. 

 

TESTING DATA I.PNG

 

try to add , if (window == null ) condition 

 

If still its not working, just for testing add this catalog client script for different catalog item to test it and disable the old one. 

 

Thanks,

Harsh