What is getXML() and getXMLWait()?

Sidhu9
Tera Contributor

Thanks

Srinu

Thanks& Regards
Sidhu !
1 ACCEPTED SOLUTION

Mohit Kaushik
Mega Sage
Mega Sage

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

 

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

View solution in original post

7 REPLIES 7

RaghavSh
Kilo Patron

getXMLWait() makes synchronous call to server while using Glide Ajax -- not recommended

get XML() make asynchronous call to server while using Glide Ajax  -- recommended

 

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


Raghav
MVP 2023

Ankur Bawiskar
Tera Patron
Tera Patron

@Srinu 

good explanation here

GlideAjax - Client

What is the difference between getXml() and getXmlWait()?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Murthy Ch
Giga Sage

Hi @Srinu 

 -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

Thanks,
Murthy

Gunjan Kiratkar
Kilo Patron
Kilo Patron

Hi @Srinu ,

 

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


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy