Author: Gajanan Karjalkar
In this blog, we will see how to upload files in NetSuite File Cabinet with the help of NetSuite Add Connector Version 11.
We will upload pdf files in File Cabinet of NetSuite. You can take the file from your respective source system. For demo purposes, I’m taking the file from the local system.
1) Take the required file from the source system.
For example: pdf file

2) Convert the payload to base64 format.
%dw 2.0
import * from dw::core::Binaries
output text/plain
---
toBase64(payload as Binary)

3) We will create DW mapping for Uploading the File.

%dw 2.0
output application/xml
ns ns0 urn:messages.platform.webservices.netsuite.com
ns ns01 urn:core.platform.webservices.netsuite.com
ns ns02 urn:filecabinet_2021_1.documents.webservices.netsuite.com
ns xsi http://www.w3.org/2001/XMLSchema-instance
---
{
ns0#add: {
ns0#record @("xmlns:ns03": ns02,xsi#"type": "ns03:File"): {
ns02#content : vars.fileContent,
ns02#name : "sample.pdf",
ns02#folder : {
ns01#internalId: "12537"
}
}
}
}
4) We will use NetSuite Add connector for uploading a file in NetSuite.

5) We will map the output of the Add connector and convert it to json/xml format.

6) We will get the response in the format below.

As we can see the sample file in pdf format has been uploaded to NetSuite’s File Cabinet.

Similarly, we can upload various types of file formats as well.
References:
1) https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2017_2/schema/record/file.html
2) https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4443156951.html