
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2021 11:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2021 06:47 AM
Hi Srinu,
You can refer SN pro tips link shared below and look for Glide Ajax from the Client section.
https://snprotips.com/blog/2016/2/6/gliderecord-client-side-vs-server-side#script-include
Although as fellow community members have mentioned about this already that getXML() and getXMLWait() are the functions or queries which we use in our client script to get the response from the script include running at server side.
Now here comes the best part although both the functions help you to retrieve the response from Server but in different ways.
getXML() will place an asynchronous call to the server and will not wait for the response before handing over the control to client.
on contrary getXMLWait() will do a synchronous call and let the client wait until the response is received from server.
What is good and bad here:
1. getXML() is good practice and getXMLWait() is bad.
2. getXMLWait() can only be used for onSubmit() client script if necessary because it will hold your form from getting submitted until the response is received from script include.
3. getXML() enhance your performance by giving the control to user without waiting for the response so that client can continue with other things on the form.
Please mark this answer as correct and helpful if it resolves the query and helpful alone if it lead you in right direction.
Thanks,
Mohit Kaushik
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2021 05:28 AM
getXMLWait()--->makes synchronous call to server while using Glide Ajax -- not recommended
Why Not Recommended?
A:) Because serviceNow don't want to wait the person 🙂
get XML()---> make asynchronous call to server while using Glide Ajax -- recommended
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2021 06:47 AM
Hi Srinu,
You can refer SN pro tips link shared below and look for Glide Ajax from the Client section.
https://snprotips.com/blog/2016/2/6/gliderecord-client-side-vs-server-side#script-include
Although as fellow community members have mentioned about this already that getXML() and getXMLWait() are the functions or queries which we use in our client script to get the response from the script include running at server side.
Now here comes the best part although both the functions help you to retrieve the response from Server but in different ways.
getXML() will place an asynchronous call to the server and will not wait for the response before handing over the control to client.
on contrary getXMLWait() will do a synchronous call and let the client wait until the response is received from server.
What is good and bad here:
1. getXML() is good practice and getXMLWait() is bad.
2. getXMLWait() can only be used for onSubmit() client script if necessary because it will hold your form from getting submitted until the response is received from script include.
3. getXML() enhance your performance by giving the control to user without waiting for the response so that client can continue with other things on the form.
Please mark this answer as correct and helpful if it resolves the query and helpful alone if it lead you in right direction.
Thanks,
Mohit Kaushik
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2025 05:28 PM
Hi ServiceNow Community Developers,
So what do I do if I need to wait for the response before I proceed in my script? Can I achieve that behavior with GetXML() function?
For instance, let's say I need to do a server side lookup before submitting my form and the submission depends on the value returned by the AJAX call, can I use GetXML() in my onsubmit client script or GetXMLWait) is my only option in that use case.
Kindly advise please.
Thanks,
Johannes