AnsweredAssumed Answered

Returning a Netsuite Filecabinet (folder) list of Files

Question asked by ccordero331194 on Jan 31, 2018
Latest reply on Apr 12, 2018 by vfalk

hi all:

 

does anyone have an example of how to read and then return the list of files from a specific folder ID using a Groovy Script in a data processing shape?

 

I am trying the following but just getting a "FALSE Value" returned...

 

thanks in advance,

 

cesar

 

headers.addHeader("SOAPAction", "get");

SOAPPart soapPart = soapMessage.getSOAPPart();

//String serverURI = "https://webservices.sandbox.netsuite.com/"; //Not in use

// SOAP Envelope
SOAPEnvelope envelope = soapPart.getEnvelope();
envelope.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
envelope.addNamespaceDeclaration("xsd", "http://www.w3.org/2001/XMLSchema");

SOAPHeader header = envelope.getHeader();

SOAPElement appInfo = header.addChildElement("applicationInfo","","urn:messages_2_6.platform.webservices.netsuite.com");
SOAPElement appId = appInfo.addChildElement("applicationId","","urn:messages_2_6.platform.webservices.netsuite.com");
appId.addTextNode(app);

SOAPElement partnerInfo = header.addChildElement("partnerInfo","","urn:messages_2_6.platform.webservices.netsuite.com");
SOAPElement partnerId = partnerInfo.addChildElement("partnerId","","urn:messages_2_6.platform.webservices.netsuite.com");
partnerId.addTextNode(acc);

SOAPElement passport = header.addChildElement("passport","","urn:messages_2_6.platform.webservices.netsuite.com");

SOAPElement email = passport.addChildElement("email","","urn:core_2016_2.platform.webservices.netsuite.com");
email.addTextNode(em);

SOAPElement password = passport.addChildElement("password","","urn:core_2016_2.platform.webservices.netsuite.com");
password.addTextNode(pword);

SOAPElement account = passport.addChildElement("account","","urn:core_2016_2.platform.webservices.netsuite.com");
account.addTextNode(acc);

SOAPElement role = passport.addChildElement("role","","urn:core_2016_2.platform.webservices.netsuite.com");
role.setAttribute("internalId", "18"); //3 designates an Admin role

// SOAP Body
SOAPBody soapBody = envelope.getBody();
SOAPElement get = soapBody.addChildElement("get", "", "urn:messages_2_6.platform.webservices.netsuite.com");
SOAPElement baseRef = get.addChildElement("baseRef", "", "urn:messages_2_6.platform.webservices.netsuite.com");
baseRef.addNamespaceDeclaration("q1", "urn:core_2016_2.platform.webservices.netsuite.com");
baseRef.setAttributeNS("http://www.w3.org/2001/XMLSchema-instance","xsi:type","q1:RecordRef");
//baseRef.setAttribute("internalId",fileID); //59379
//baseRef.setAttribute("type","file");
baseRef.setAttribute("internalId",folderID); //59379
baseRef.setAttribute("type","folder");//2388

soapMessage.saveChanges();

/* Print the request message */
System.out.print("Request SOAP Message = ");
soapMessage.writeTo(System.out);
System.out.println();

return soapMessage;

Outcomes