Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Convert string into XML

kunal16
Tera Expert

How can I convert a string character into an XML one?

Any help will be appreciated. Thanks in advance.

2 REPLIES 2

sudharsanv36
Kilo Guru

Hi Kunal,



This might help you XMLDocument Script Object - ServiceNow Wiki


josh_nerius
ServiceNow Employee
ServiceNow Employee

Hi Kunal,



Here are some APIs you should look at:



  • XMLDocument2 - this gives you a parseXML(xmlString) method that lets you take your string and turn it into an XMLDocument2 object.
  • gs.xmlToJSON(xmlString) - this allows you to convert an XML string into a JavaScript object. It's often easier to work with a JS object representation of the data.