Proposal summary
Export Saved Search result into 3rd party storage
Requirement
There will be different saved searches already created in NetSuite. This should be exported to a third party storage (like SFTP server or Sharepoint) in a predefined Date Format
Our Solution
There will be a custom record named ‘Saved Search Export’. This custom record will store the reference to the saved searches as well as the last executed date ( and the CSV file generated from the saved search result)
There will be two scheduled functions which will run daily
- First function : This process will go through each custom record, find the saved search, execute it and store the result as CSV into a predefined path on the file cabinet. The reference to the generated CSV file will be stored in the custom record as well.
- Second function : Export the files into an SFTP server to the predefined location
- The CSV files (saved search results) will be pushed to the location ‘/home/secondsrx/ftp/production/outbox’
- If there are any error while exporting data to SFTP server this will be either tracked in
- The location ‘/home/secondsrx/ftp/production/outbox/failed_data_sets’ on the SFTP server
— OR — - on the same corresponding custom record
- The location ‘/home/secondsrx/ftp/production/outbox/failed_data_sets’ on the SFTP server
Assumptions
- The script won’t be adding any additional filters or columns to the existing saved search while execution for the generation of the CSV file (which contains the search result)
- Creation of the CSV files by executing the saved search is not an immediate action, instead this will a scheduled action
- This is a daily process which will run only once
- Saved Searches should be public so that this can be linked to the custom record
- The search result will be stored in the File Cabinet as a CSV file. The NetSuite users with access to the custom record or file cabinet will be able to see those files (even if they don’t have access/permission to execute the saved search)
Risks
- The size of the generated CSV file should be less than 10MB. If not, this cannot be exported from NetSuite into the SFTP server – First export will be done manually. So the daily result will not be exceeded in its data volume.
- The saved searches should contain the necessary filters (say the date created ) to control the search result count so as to control the file size within the 10MB limit moving forward. If not, this cannot be exported from NetSuite into the SFTP server if the file size is 10MB or more.
Questions/Prerequisites
- The format for the file name (naming convention) which is to be followed throughout
- The time of day on when to run the saved search and to export the data
Time
Estimated Effort: 28 hrs