SuperSync Files - Archive Files

Overview

SuperSync Files version 0.6.0 introduced the capability to automatically archive files that exist in the NetSuite File Cabinet. This guide will walk you through the process of one-off archiving of files or on a schedule as well as how to see what files have been archived in NetSuite. 

Prerequisites: SuperSync Files Version 0.6.0. NetSuite Administrator Access. This requires a familiarity with setting up NetSuite saved searches.

How File Archiving Works

File Archiving works by running a Saved Search against a target record type (customers, invoices, journal entries etc.) and including in those search results a list of file attachments which reside in the NetSuite file cabinet. The Archive Scripts will then take each of files listed in the results, look-up the record type configurations, build the correct folder path on the external file repository (Sharepoint or Google Drive) and then place the file in the correct location. 

After making a copy of the file on the external file repository the Archive script will then move the file in the file cabinet to a dedicated "archived" folder. The script will NOT automatically delete files from the file cabinet. This must be done by users manually as a safety precaution. However this action can be done in bulk by deleting the entire archive folder and all contents. This is described more below. 

High-Level Steps to Archive Files

a) Enable the record type for archivingView in full screen

b) Create a Saved Search listing all files to be archivedView in full screen

c) Setup an "Archive Config" record View in full screen

d) Schedule the script to run (or run once off) View in full screen

e) Optionally review and/or delete the archived files from the file cabinet

View in full screen

Step by Step Process

A - Enable the record type for Archiving

  1. Navigate to SuperSync Files > Configs and select Record Type Configs.
  2. Select Edit for the record type in need of archiving.
  3. Navigate to the Other Settings tab, check the Enable Automatic File Archive box and select Save

B - Create a saved search listing all files to be archived

  1. Create a new Saved Search which will produce the list of files to be archived. The Saved Search being created in NetSuite can be of any target type (invoice, customer, custom record search etc.) but it should NOT simply be a search of files. The search type must be of the target record type (invoice, customer, etc.) so that the Archive script can look-up the correct path configurations for the record. Saved searches can be found under the Lists menu in NetSuite for most logins. For more data on creating Saved Searches, see the NetSuite standard documentation.
  2. When creating the search, there are two specific fields that MUST be configured which are file_name and file_id. The sequence of fields does not matter. Adding other fields in addition to these is fine, they will be ignored by the script. To add these fields, select the Results tab and under the list of Columns add a  new Field by going to the "File Fields..." optionThis will cause a pop-up to appear.
  3. On the pop-up after selecting "File Fields..." click the Add Multiple button.
  4. Select the Internal ID and Name fields. And then click the Add button.
  5. This will bring you back to the list of fields. Give the File Internal ID and File Name fields custom labels file_id and file_name. It is important to name these correctly as the Archive script is looking for these specific column names to identify the files to archive.
  6. Add more fields if it is useful for informational or review purposes. They will be ignored by the script.
  7. Edit the search Criteria to select only files or records that you want to archive. The example below finds only files that were created prior to the end of the previous year and only returns files associated with Leads and Prospects, not customers. This is just an example but serves to illustrate that you can build filter criteria concerning the record the file is associated with OR file file itself.  8. Give the Saved Search a sensible Search Title, make sure to check the box to make it Public and then click Save.

C - Setup an "Archive Config" record

  1. Navigate to SuperSync Files > Archive Files > File Archive Configs.
  2. Select New SSF | Archive Config.
  3. Give the configuration a sensible Name so you can remember which types of tiles this configuration pertains to.
  4. Navigate to the Saved Searches field and select the dropdown.
  5. Select the Saved Search which was created in the earlier step Done. Note that more than one Saved Search can actually be selected here. If more than one is selected the files returned by all searches will be archived. 
  6. Select Save on the Archive Config record.

D - Schedule the script to run (or run once-off)

  1. From the list of Archive Config records, select View on the one you would like to schedule or to preform a once-off run on. 
  2. To run the script immediately on a once-off basis without scheduling it, select Run Archive Now. To schedule the script, jump to step #4.
  3. Depending on the number of files to be archived, the script may take some time to process. You will see a pop-up window tracking the steps as listed below. The script to archive files is running as a background process at this point so it is safe to close the window and navigate away if you like. 
  4. To setup a recurring schedule for the script go to view mode and click the Schedule Archive button. 
  5. The bundle relies on NetSuite Scheduled Scripts to run in the background for this next step. The Files bundle will check if a script is already associated with this Archive Config. If it can not find one, you will see this message. You will require access to NetSuite SuiteScript from you role to perform the next step. To continue, click OK.
  6. Edit the script deployment by making the following changes. For more general help with Scripts and Script deployments see the standard NetSuite documentation. Give the script deployment a sensible title and in the Status dropdown select Scheduled.
  7. Under the schedule tab, create a schedule for the script. The below example has been setup to illustrate how to setup the Archive Files script to run on the 1st of every month. There are a lot of variations possible. 
  8. Double check under the Parameters tab that the Archive Files Config shows the correct value. If you followed the above instructions it should already be linked correctly.
  9. Select Save on the Script Deployment. It will now be setup to run on schedule.

E - Optionally review and/or delete the archived files from the file cabinet

  1. After the script has run (once-off or on schedule) you can review a list of all files that have been archived. Archived files, after being created on the external file system will be moved to an Archived location in the NetSuite File Cabinet for easy review and manual deletion. Navigate to SuperSync Files > Archive Files > Archived Files
  2. This folder contains all files archived by the script. A new folder titled SSF | Archived Files will be created each time the script is run. It will be named based on the date the files were archived.
  3. The archived files now have a title prefaced with SSF | Archived. This is done to make it amply clear to the script not to upload the file a second time to the external file repository. 

4. If desired, the files can now be deleted. The Delete Files button can be used from the main "archived" folder to delete more than one batch of files at once. 

Troubleshooting

If a single file in NetSuite is linked to multiple record types (for example, both an invoice and a sales order), and you want that file to be archived in multiple folders in SharePoint (e.g., one under “Invoices” and another under “Sales Orders”), the same File Archive Config must include saved searches for all related record types.

This is because the file exists only once in NetSuite and is archived only once per File Archive Config run. If it’s matched by a saved search in one config and archived, the system marks it as already archived. As a result, if you try to archive it again using a separate File Archive Config (with a different saved search), the file will be skipped because it’s already considered archived.

To ensure it’s saved in multiple SharePoint locations, all relevant saved searches must be included in the same File Archive Config.

If any difficulties or issues arise, please reach out to supersync@netgain.tech for resolution.


Was this article helpful?