jayaram
03/21/2024, 3:04 PMleo_ns
03/21/2024, 5:37 PMleo_ns
03/21/2024, 5:40 PMjayaram
03/21/2024, 5:45 PMleo_ns
03/21/2024, 5:53 PMjayaram
03/21/2024, 6:01 PMleo_ns
03/21/2024, 6:08 PM/**
* @NApiVersion 2.x
* @NScriptType Restlet
* @NModuleScope SameAccount
*/
define(['N/xml'], function(xml) {
function getPersonData() {
// Define person data
var personData = {
id: 1,
name: "Jayaram"
};
// Create XML document
var xmlDoc = xml.createDocument();
var rootNode = xmlDoc.createElement({
name: 'person'
});
// Create child elements for person data
var idNode = xmlDoc.createElement({
name: 'id'
}).textContent = personData.id;
var nameNode = xmlDoc.createElement({
name: 'name'
}).textContent = personData.name;
// Append child elements to the root node
rootNode.appendChild(idNode);
rootNode.appendChild(nameNode);
xmlDoc.appendChild(rootNode);
// Serialize XML document to string
var xmlString = xmlDoc.toString();
return xmlString;
}
function doGet() {
return getPersonData();
}
return {
get: doGet
};
});
leo_ns
03/21/2024, 6:09 PM<person>
<id>1</id>
<name>Jayaram</name>
</person>
jayaram
03/21/2024, 10:30 PMleo_ns
03/21/2024, 11:24 PMjayaram
03/21/2024, 11:26 PMleo_ns
03/21/2024, 11:28 PMleo_ns
03/21/2024, 11:29 PMjayaram
03/21/2024, 11:30 PMjayaram
03/21/2024, 11:31 PMleo_ns
03/21/2024, 11:32 PMjayaram
03/21/2024, 11:34 PMEmanuel V
03/22/2024, 4:22 AMjayaram
03/22/2024, 4:18 PM