Hi all! I have a xml doc saved in my file cabinet....
# suitescript
g
Hi all! I have a xml doc saved in my file cabinet. I want to load it (and parse it) in a scheduled script. Any one can give me some direction?
s
Use
N/file
and
getContents()
g
when i do that and log the results of getContents() i get untitled
b
make sure you escape the xml before printing
otherwise use the debugger
g
I am using the debugger
b
what does your code look like
g
i think i found the issue. for some reason the file is empty and when I save data it only saves for a couple seconds
any idea why thi would happen ?
b
my guess would be that something is overwriting it
g
got it!! thanks!
any specific way to parse the xml in suitescript or i can use any JS method?
b
N/xml is generally a pain to work with
g
so what is my best bet?
basically i am pulling in orders from a selling channel and they are provided in xml
e
N/xml
may be a pain, but is the intended way to parse XML in SuiteScript. If you'd prefer something else, there are plenty of JS libraries for parsing XML into JSON or other structures: https://www.npmjs.com/search?q=xml%20to%20json