We are looking to import a file link within the Im...
# ask-stanley-ai
j
We are looking to import a file link within the Import Manager . What would be the best way to do this so that the File is available in Netsuite> How would we also do this via API
c
AI generated answer (using internal Slack threads):
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** To import a file link within the Import Manager, you can use the
N/file
or
N/folder
module in SuiteScript. These modules provide methods to interact with the file cabinet in NetSuite. Here is a basic example of how you can use the
N/file
module to create a file:
Copy code
javascript
var fileObj = file.create({
    name: 'test.txt',
    fileType: file.Type.PLAINTEXT,
    content: 'Hello, World!',
    folder: 123
});
var fileId = fileObj.save();
In this example,
name
is the name of the file,
fileType
is the type of the file,
content
is the content of the file, and
folder
is the internal ID of the folder where the file will be saved. The
save
method is used to save the file to the file cabinet and it returns the internal ID of the saved file. To import files via API, you can use the RESTlet API. You can create a RESTlet script that uses the
N/file
or
N/folder
module to interact with the file cabinet. Then, you can call this RESTlet script from your external application to import files. Please note that you cannot directly link to files on a shared drive from NetSuite due to browser security reasons. You might want to consider using a cloud-based storage solution that can be accessed from NetSuite. Also, please note that you cannot upload a file to the file cabinet over SFTP without having a login to NetSuite. However, you can create a Suitelet URL which your app pings and calls the above.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.827547908
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.820219696
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.818069756
Please provide your feedback on this answer.