Parse XML to JSON using NetSuite ‘N/xml’ module

Create a helper.js file so the function can be shared across different scripts. /**  * @NApiVersion 2.1  */ /************************************************************************************************  * * Parse XML **  *  *  * **********************************************************************************************  *  * Author: Jobin and Jismi IT Services  *  * Date Created : 29-August-2022  *  * Created By: Manu Antony  *  * Description : Custom module for parsing XML… Continue reading Parse XML to JSON using NetSuite ‘N/xml’ module

Extract data from XML body

Solution Below given a sample XML body From this, we can extract data using the below sample code var fileContent = fileObj.getContents(); //if xml data is in file //Parse XML to a variable var xmlObj = xmlMod.Parser.fromString({ text: fileContent }); //Getting values from 945 XML file //Traverse to each node var orderheader = xmlMod.XPath.select ({… Continue reading Extract data from XML body