I'm JUST starting to learn about E4X and creating XML Documents with javascript. I have been using examples found online to experiment with a simple SuiteLet.
Here is the code:
var AvailableSNRequestHandler = { /** * @param {nlobjRequest} request * @param {nlobjResponse} response */ Execute: function ASNRH_execute(request, response) { var xml = new XML(); xml = <order> <date>2005-08-01</date> <customer> <firstname>John</firstname> <lastname>Johnson</lastname> </customer> <item> <name>Maxilaku</name> <qty>5</qty> <price>155.00</price> </item> </order>; var txt = nlapiXMLToString(xml); response.write(txt); }, } The code above results in the error:nlobjResponse: Missing a required argument: output
It appears this is because the variable 'txt' is empty or null.If I write the xml document to the response I get the formatted xml text. I think this is good? I really don't know because at one point when I sent the xml directly to the output buffer I got all the values listed one after another; no xml structure.So I'm a little confused. Why is nlapiXMLToString() returning null?