When we use getXML over getXMLAnswer ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 11:27 PM
Performance wise and code wise community is suggesting to use getXmlAnswer when we are just depends on answer but most of the cases are same in terms of requirements I have seen.
so in which cases/business scenarios where we are compelled to use getXml over getXmlAnswer??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2024 04:39 AM
Hello @Manikantahere ,
Please refer to the thread below. I hope it provides a better understanding.
https://www.servicenow.com/community/developer-articles/getxmlanswer-vs-getxml/ta-p/2307589
Please mark this as "correct" and "helpful" if you feel this answer helped you in anyway.
Thanks and Regards,
Ashish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2024 02:02 AM
This link will provide more insights - https://www.servicenow.com/community/developer-articles/getxmlanswer-vs-getxml/ta-p/2307589
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.
********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect
Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2024 03:54 AM
Hello @Manikantahere
The choice between using getXML() and getXMLAnswer() in ServiceNow depends on the complexity of the data returned by the server-side script, the structure of the response, and how you intend to handle that response on the client side.
Key Differences:
- getXML(): Returns the entire XML response from the server-side script. It allows detailed parsing of the XML structure using DOM methods.
- getXMLAnswer(): Extracts and returns only the <answer> element from the XML response. This is simpler and faster when you only need the result of the <answer> element.
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps others find the solution more easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2024 09:19 PM
Even I can get list of values using getXmlAnswer right?
for example if I want get user information by gliding user table you are saying we use getXml but can't I get user information using getXmlAnswer?
if this is not the scenario where we need to use getXml let me know any good scenario for my understanding?
in real time what were the scenarios may I know?