When to use getXML vs getXMLAnswer in Glide Ajax
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2024 07:45 PM
Hello Experts,
Need help in Understanding GlideAjax , when to use getXML and when to use getXMLAnswer.
What I know is
when we use getXML we need to add the line, "var answer = response.responseXML.documentElement.getAttribute("answer")".
When we use getXMLAnswer we save our time by skipping the "var answer = response.responseXML.documentElement.getAttribute("answer")"
I wanted to know what is the best scenario where I can. Decide what to use based on the situation
Asynchronous Glide Ajax
var ga = new GlideAjax('ScriptInclude');
ga.addParam('sysparm_name','function_name');
ga.addParam('sysparm_user',"parameter1");
ga.getXML(HelloWorldParse);
A callback function :
function HelloWorldParse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
}
Need help. Thanks in advance 😃

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2024 07:24 AM
Hi there,
This article which I wrote 4 years ago answers your question.
- 2019-12-23 - Article - getXMLAnswer vs getXML
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2024 11:04 AM
Hi @anvitha ash ,
You can refer the below article which explains the uses of getXML vs getXMLAnswer,
https://www.servicenow.com/community/developer-articles/getxmlanswer-vs-getxml/ta-p/2307589
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang