what is difference between getxml and getxmlwait

Apsara P
Tera Contributor
 
3 REPLIES 3

Martin Ivanov
Giga Sage
Giga Sage

https://www.servicenow.com/community/developer-forum/what-is-getxml-and-getxmlwait/m-p/1718530

 

Please refer to this article


Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

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 more information you can read the below link:-

 

https://www.servicenow.com/community/developer-forum/what-is-getxml-and-getxmlwait/m-p/1718530

 

Please mark answer correct/helpful based on Impact.

Hayo Lubbers
Kilo Sage

getXML() or getXMLAnswer() will process your request a-synchronously.

getXMLWait() doesn't process any other requests, until the response is processed.

 

Please only use getXMLWait() if really necessary, since it holds the user interaction until the reponse is processed.

 

More information at : https://developer.servicenow.com/dev.do#!/reference/api/tokyo/client/c_GlideAjaxAPI#r_GLAX-getXML_S

 

getXML(Function callback)
Sends the server a request to execute the method and parameters associated with this GlideAjax object.
The server processes the request asynchronously and -- when ready -- returns the results via the function specified as the callback_function.

 

getXMLAnswer(Function callback, Object additionalParam, Object responseParam)
Calls the processor asynchronously and gets the answer element of the response in XML format.

 

getXMLWait()
Sends the server a request to execute the method and parameters associated with this GlideAjax object.
The server processes the request synchronously and will not process further requests from the client until finished. To retrieve the results, the client must call getAnswer(). Using getXMLWait() ensures the order of execution, but can cause the application to seem unresponsive, significantly degrading the user experience of any application that uses it. We recommend using getXML() instead.
Note: getXMLWait() is not available to scoped applications.