Is there any way to call script include synchronously from service portal other than getXMLWait()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2018 01:34 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2018 04:43 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2018 05:04 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2018 05:06 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2018 05:08 AM
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?