Modules
Objects/Functions
SuiteScript 2.0
{Node}.appendChild({newChild: {xml.Node}})
N/xml Module
Node.appendChild()
Method Description:
Appends a node after the last child node of a specific element node. Returns the new child node.
Returns:
xml.Node
Supported Script Types:
All script types
For more information, see SuiteScript 2.0 Script Types.
Governance:
None
Module:
N/xml Module
Since:
2015.2
Search NetSuite -
https://system.netsuite.com/app/help/helpcenter.nl?search=Node.appendChild(options)
Example:
// Code Example 1
//Add additional code
//...
var bookShelf = xml.Parser.fromString(file.load('SuiteScripts/books.xml').getContents());
var newBookNode = xmlData.createElement("book");
var newTitleNode = xmlData.createElement("title");
var newTitleNodeValue = xmlData.createTextNode("");
var newAuthorNode = xmlData.createElement("author");
var newAuthorNodeValue = xmlData.createTextNode("");
newTitleNode.appendChild(newTitleNodeValue);
newAuthorNode.appendChild(newAuthorNodeValue);
newBookNode.appendChild(newTitleNode);
newBookNode.appendChild(newAuthorNode);
var newbook = bookShelf.appendChild({
newChild : newBookNode
});
//...
//Add additional code
//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_459708190917.html