Is there any way to call script include synchronously from service portal other than getXMLWait()

Prateek Gupta3
Mega Guru

Hi All,

 

Is there any way to call script include synchronously from service portal other than getXMLWait()?

I am using getXMLWait() in onSubmit client scripts.

 

 

Thanks in advance.

Prateek Gupta

 

8 REPLIES 8

Chandu Telu
Tera Guru
Tera Guru

HI Guptha,

I am not sure on your requirment but you can use this

client side

SetTimeout() function 

Server side

gs.sleep

 

https://community.servicenow.com/community?id=community_question&sys_id=caf8c7a1db5cdbc01dcaf3231f96191a

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

 

YEs there is a way to call that:

 

See below:

 

1) User getXML with a call back function.

 

2) Write function directly into getXML.

 

Useful Links:

https://community.servicenow.com/community?id=community_question&sys_id=e56b8b21db9cdbc01dcaf3231f961959

 

https://community.servicenow.com/community?id=community_question&sys_id=c2f5c361db1cdbc01dcaf3231f96190c


Thanks,
Ashutosh Munot

 

Please Hit Correct, ️Helpful depending on the impact of the response

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,


See sample code:

gb = new GlideAjax('HMgetSubCat2');

  gb.addParam('sysparm_name', 'getSubCat');

  gb.addParam('sysparm_category', oldValue);

  gb.getXML(function(response) {

  var answerA = gb.getAnswer();

  var objA = JSON.parse(answerA);

  console.log('JC Debug answer='+answerA);

  for(var j=0; j<objA.length; j++){

  console.info("JC Debug Remove Option: " + objA[j].value);

  g_form.removeOption('u_subcategory',objA[j].value);

  }

  });

 

Links:

https://community.servicenow.com/community?id=community_question&sys_id=7db05f69dbdcdbc01dcaf3231f961929&view_source=searchResult

 

https://community.servicenow.com/community?id=community_question&sys_id=bbc9d0d7db10db00852c7a9e0f961972&view_source=searchResult


Thanks,
Ashutosh Munot

Chuck Tomasi
Tera Patron

The whole point of Service Portal and responsive modern apps is speed - you don't have to (nor want to) wait for a response. it kills the experience.

 

What is the underlying business requirement you are trying to accomplish?