GlideAjax.getXMLWait spam for g_form.addOption() ???

Marcor1
Giga Contributor

Hello,

i know the following article about round trips of the serviceNow system

https://community.servicenow.com/community?id=community_blog&sys_id=b23deae5dbd0dbc01dcaf3231f961992&view_source=searchResult

but still i cannot figure out why the system is spamming

 "*** WARNING *** GlideAjax.getXMLWait - synchronous function - processor: AjaxClientHelper"

when i add options to a choice field on the incident form dynamically. The system is sending the following header each time an option is added (g_form.addOption()) to my custom choice list:

sysparm_processor: AjaxClientHelper
sysparm_scope: global
sysparm_want_session_messages: true
sysparm_name: getDisplay
sysparm_table: sys_user_group
sysparm_value: 
sysparm_synch: true
ni.nolog.x_referer: ignore
x_referer: incident.do

The options are retrieved by an asynchronous ajax call which works fine. As soon as the client script starts to loop over the retrieved options and add them to the choice field, the system starts spaming the synchrounous ajax calls ...

Does anyone know why the system behaves this way? The addOption function does not have a DisplayValue does it?

if (options.length > 0) {		
    g_form.addOption('myChoiceField', '', '-- None --');
    for (var i = 0; i < options.length; i++) {
        if(options[i] != null){					
            g_form.addOption('myChoiceField', options[i], options[i]);
        }
    }
 }
1 ACCEPTED SOLUTION

Modify it like this

function onChangeMyChoiceField() {

if(newValue == "" || isLoading){

return;

}else if(oldValue != newValue){

//Your changes here

}

}

View solution in original post

6 REPLIES 6

Modify it like this

function onChangeMyChoiceField() {

if(newValue == "" || isLoading){

return;

}else if(oldValue != newValue){

//Your changes here

}

}

Thanks, now the onChange function does not get triggert by addOption(). This is a cascading problem -.-