WHEN SUBMITTING A CATALOG ITEM IN NATIVE UI VIEW GETTING AN ERROR ON SUBMIT

YerragondaA3099
Tera Contributor

Hi All,
When a user is trying to submit an request for catalog item it is throwing an error on submit (attached error)

YerragondaA3099_0-1780668289882.png

 


Also attached the browser console error message and the on submit client script configured.There is only one on submit client script configured for this catalog item.

YerragondaA3099_1-1780668309701.png

 

YerragondaA3099_2-1780668354574.png

 


Please let us know what changes to be done .

Thank you .


 

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@YerragondaA3099 

your onSubmit is causing the issue

it's using DOM manipulation. If you want to use DOM manipulation then Isolate Script field should be false

what's the acceptPolicy check requirement?

55.png

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar ,

Thank you for the quick response,

YerragondaA3099_0-1780669156732.png

These are the current configurations .

@YerragondaA3099 

you see the Isolate Script field is True for that and hence it's causing error

but what's the requirement there?

there could be better way to achieve the requirement without DOM as well

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Tanushree Maiti
Tera Patron

Hi @YerragondaA3099 

 

Can you confirm whether acceptPolicy is a variable of Multi row variable set or any other variable set.

Because in your onSubmit code , saw "parent.document".

 

Did you check whether you can avoid DOM manipulation as KB0954537 Client-side code should not use DOM manipulation techniques 

 

If acceptPolicy is variable of MRVS , you can use following 

 modern, upgrade-safe onSubmit Client Script to achieve the same result:
 
Sample code /Not tested
function onSubmit() {
       var isAccepted = g_form.getValue('accept_policy'); 
var isParentAccepted = parent.g_form.getValue('accept_policy');

if (isAccepted !== 'true' && isAccepted !== '1' && isAccepted !== true) { alert('Please read and accept the policy'); return false; }
else if (isParentAccepted !== 'true' && isParentAccepted !== '1' && isParentAccepted !== true){
alert('Please read and accept the policy'); return false;
} }

Refer : Access Parent/Other variables inside MVRS

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti