
- 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-20-2021 11:45 PM
getXMLWait() makes synchronous call to server while using Glide Ajax -- not recommended
get XML() make asynchronous call to server while using Glide Ajax -- recommended
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2021 02:56 AM
good explanation here
What is the difference between getXml() and getXmlWait()?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2021 05:22 AM
Hi
-getXMLWait() is used when you want to halt processing until the results are returned. This will halt everything and wait for it to finish and return the results
- getXML() is used when you want processing to continue, even if the results have not been returned
getXML() is the best practice and recommended
Thanks,
Murthy
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2021 05:23 AM
Hi
getXMLWait() - Wait till the time we get input from server & then move ahead.
For instance when you are trying to retrieve value of the field & after getting value then only it should proceed to next step like comparing it with user input.
getXML() - If you are retrieving some data from server and next tasks does not depend on what you are retrieving from server. Ideally, used so as to avoid any performance load.
For additional information you may refer link.
Please mark my answer as helpful/Correct so that these threat will close and it will benefitted to others as well.
Regards,
Gunjan