Substitute of getXMLWait() in scoped application

rajpalj
Tera Contributor

We have a requirement to block form submission after calculations in GlideAJAX response. Since getXML is async even though the submission fails we are not able to block the submission. 

Is there any other method we can use in scoped application to make this synchronous. Thanks!

3 REPLIES 3

SanjivMeher
Kilo Patron
Kilo Patron

There is a solution in the below thread which may work for you.

 

https://www.servicenow.com/community/developer-articles/how-to-fix-onsubmit-data-validation-once-and...

 

https://www.servicenow.com/community/itsm-forum/i-am-unable-to-use-getxmlwait-in-scoped-application/...

 


Please mark this response as correct or helpful if it assisted you with your question.

Sohithanjan G
Kilo Sage
Kilo Sage

Hi @rajpalj 

To mitigate this fundamental behavior, the form should be submitted again and this should be handled in the callback function of the getXML.

function onSubmit() {
if (g_scratchpad.isFormValid){
	return true;
}
var actionName = g_form.getActionName();
var ga = new GlideAjax("SOMEFUNCTION");
ga.addParam(.....);
ga.getXML(function() {
	g_scratchpad.isFormValid = true;
	g_form.submit(actionName);
});
	return false;
}
Please mark as Accepted Solution if this solves your query and HIT Helpful if you find my answer helped you. This will help other community mates too..:)

Hello, Thanks for you response. I see this error when I use g_scratchpad.

rajpalj_0-1711130468135.png