views:

120

answers:

2

I have a large product list and need to generate a static file of it, and have that file be accessible in my website. Currently, I generate the list, and upload it to the file cabinet. I wish to automate this process. I would like to schedule a SuiteScript to run each night and generate this list and update a file in the file cabinet.

Can this be done?

thanks

+1  A: 

You can automate this process with SuiteScript. You would use the nlapiLoadFile and nlapiSubmitFile calls to accomplish it. If you have a large product list you are likely to encounter a few other issues. You are likely to hit governance limits and will need to develop this script so that it tracks progress and reschedules itself appropriately. SuiteScript searches will only return the first 1000 records. If you have more than 1000 items to include in this file, you will likely need to use a flag on the item record to track which items remain for export. There is currently a 5MB limit on the file size when loading or creating files using SuiteScript.

Mark Simon
Thanks very much. I am ready to move forward on this finally. I have done some reading of the API documentation. My product list will be around 500 items, and I only need a few columns, so I do not think I will hit any governance/size limits. Do you have a suggestion as to where to find example scripts/code that does this action? Thanks in advance for your help on this.
Rob
+1  A: 

Example SuiteScript to create a file:

var data = 'Your,CSV,File,Here';
var folderId = 519; // Your File Cabinet folder ID here

// Create the file and add it to the folder
var f = nlapiCreateFile('products.csv', 'CSV', data);
f.setFolder(folderId);
var id = nlapiSubmitFile(f);

// If you want to attach the file to a record, you can do something like this:
nlapiAttachRecord('file', id, 'customrecord_x', recordId);

NetSuite developers and power users, come over to: http://area51.stackexchange.com/proposals/22863/netsuite-community-support

Vincent
Thanks Vincent ... I will check out the new proposed stackexchange community you proposed.
Rob