Is there a way to synchronize with getXml?

YoungJae Kim
Tera Contributor

When I try to use getXmlWait, the error

'Access to getXmlWait is not available in scoped applications' appears as shown in the picture.

 

Even if return from callback, synchronization is not possible when use getXML.

After getting the value from callback, if it is over 10000, I try to return false in onsubmit and not proceed.

 

Please Help me.

 

getXMLWait not use.png

 

==example==

Catalog Client Script - onSubmit

============================

 
var global = false;
function onSubmit() {
    ~~~
    var ga = new GlideAjax(~~);
    ga.addParam('sysparm_name', 'getCount'); <-- return gr.getRowCount()
 
    var rtn = ga.getXML(callback);  <-- rtn value is null 
    if( rtn == false || global  == false ) {
         return false;  <-- If the conditions are met, it must prevent submit.
    }
 
}
 
function callback(response) { 
    var answer = response.responseXML.documentElement.getAttribute("answer");
    if( answer >= 10000 ) {
         global = false; <-- not sync
         return false;  <-- This is of no use at all. I must return false in onSubmit().
    }
}
 

 

============================


1 REPLY 1

Saurabh Gupta
Kilo Patron
Kilo Patron

Hi,
You can create a temp field which basically should use for making sure the value is returned from server and marked this field as mandatory. Once return populate it.


Thanks and Regards,

Saurabh Gupta