Team, I am trying to send an invoice record to an ...
# suitescript
a
Team, I am trying to send an invoice record to an external system as an XML file, via FTP. What do you suggest to convert the invoice record to an XML string/file? Slack Conversation
b
hopefully you mean SFTP, there is no FTP option for suitescript
k
Consider setting up an XML template and using renderer.
s
if you need more complex transformation between the NS data and XML, consider JSONIX
a
sorry, yes, SFTP
when you want to see a record in XML, you enter &xml=T this will show you the record in XML format how can I get this format in SuiteScript?
b
that xml trick is generally for the ui
you wont be able to get it without doing the equivalent of logging into netsuite via suitescript
the more usual choices are using N/xml to pragmatically build your xml
or using N/render to build up xml string template
s
or use a library like JSONIX
a
ok, thanks... but I want the entire record, not some parts, that's why a template won't help
must be an easy way to get the XML
JSONIX, that's an external library, right? is it compatible with Netsuite? how do I use it?
s
JSONIX is an external library, very flexible for converting from javascript <-> XML and it does work in NS.
I use it with NFT, which presents plain javascript object representation for NS records, and hence a nice fit for any js->xml library.
with JSONIX you define (or generate) a mapping between your JS object and the desired XML output.
a
okay, thanks, I will take a look