How to use asynchronous GlideAjax in on submit client script for validation?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2015 01:52 PM
Hello all,
We have a on submit client script which uses synchronous GlideAjax. As per ServiceNow's recommendations, we are making it asynchronous. The concern is that as below, we are waiting at line 4 for a response from the server and based on it we are either allowing the form to submit or not.
If we replace the synchronous logic with asynchronous, there will not be any waiting at line 4 and the form will be submitted without the validation taking place.
var ga = new GlideAjax('HelloWorld');
ga.addParam('sysparm_name','helloWorld');
ga.addParam('sysparm_user_name',"Bob");
ga.getXMLWait();
if(ga.getAnswer() != ''){
return true;
} else {
return false;
}
Edit: This is a catalog client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2017 02:55 AM
Please note that getXMLWait is not supported in context of the Service Portal:
Supported and unsupported client scripts