Accessing Installed Files and Folders with Descriptive URLs
The inclusion of folder hierarchies in bundles, and resulting support of descriptive URLs, makes it possible for SuiteScripts to reference files uniformly across different accounts, instead of relying upon file internal IDs that can change from account to account. To support the use of descriptive, or true path, URLs to access bundled files in target accounts, you need to enable the Available for SuiteBundles option on the File Cabinet records for files, and their folders and subfolders.
After the bundle has been installed in a target account, the following format can be used for descriptive URLs to access bundled files:
https://system.netsuite.com/c.<account ID>/suitebundle<bundle ID>/<folder>/<subfolder>/<file>.<ext>
For example, if the target account ID is 160532, bundle ID is 11006, folder names are Documents/ProductOptions, and file name is SearchStrings.txt, the descriptive URL would be:
https://system.netsuite.com/c.160532/suitebundle11006/Documents/ProductOptions/SearchStrings.txt
Guidelines for Descriptive URLs
-
You can only access files and folders with a descriptive URL if the file or folder was installed from another production account, and not from a sandbox account associated with the target account. This restriction only applies to bundles created in NetSuite Version 2015 Release 1 and later. See File and Folder Management in Bundles
-
Files are available only to users logged in to NetSuite, except for files that have the Available without Login option enabled on the File Cabinet record.
-
To support the use of descriptive URLs to access folder contents in the source account, the Host HTML Files feature must be enabled. This feature provides access to the Web Site Hosting Files/Live Hosting Files File Cabinet folder, where these folders are stored in the source account. This feature is not required for target accounts, where these folders are stored under the SuiteBundles folder.
-
If a bundle includes scripts that rely on descriptive URL access, to construct the appropriate URL in the target account, the bundle author must do the following:
-
Parameterize the target account ID using the runtime.accountId API call.
-
Parameterize the bundle ID using the Script.bundleIds API call.
Note:The Script.bundleIds API call returns an array, and the first returned bundle ID should be used to construct the URL.
-