getRecordFolderContents

getRecordFolderContents(options)

Method Description

This method gets all files and folders inside a specific record folder. It can also retrieve files and folders from the first level of sub-folders.

Returns

DirectoryItem[]

Supported Script Types

SuiteScript 2.1
Server-side Scripts: User Event, Suitelet, RESTlet, Map/Reduce, Scheduled, Workflow Action

Limitations

When using includeSubfolders the result currently only returns files from the first subfolder level.

Module

b4cd-file-api-lib.js
See notes on how to load this module: FileSync API for SuiteScript

Since

FileSync 0.5.0

Parameters

Note: The options parameter is a JavaScript object.

ParameterTypeRequiredDescription
Since
options.recordTypeConfigId

integer

required 

Internal ID of the FileSync Record Type Configuration record (customrecord_b4cd_record_type_config).

Required when there are more than one record type configuration records setup for the record type. 

0.5.0

options.recordId

integer

required

The internal ID of the record in NetSuite which we are finding associated files for. 

0.5.0

options.includeSubFolders

boolean

optional

Set the value to true to include sub-folder contents in the result.

Default value: false

Limitations: each sub-folder included will require another HTTP request to the file hosting platform and will thus count toward the NetSuite governance limits. It is not recommended to use this option on folders with a large number of child records. 

0.5.0 

Returns

PropertyTypeDescriptionSince
DirectoryItem.name

string

The file or folder name

0.5.0

DirectoryItem.uniqueId
stringThe unique ID of the file or folder as assigned by the file hosting service. 0.5.0
DirectoryItem.type
stringPossible Values: "file", "folder"0.5.0
DirectoryItem.fileSize
integerFile size in bytes.0.5.0
DirectoryItem.apiUri
stringThe URI used to access the file or folder via the API. 0.5.0
DirectoryItem.path
stringThe relative file or folder path on the file hosting service starting from the base directory. 0.5.0
DirectoryItem.uri
stringThe user-navigable URI for the folder or file on the file hosting platform. This can be used to construct hyperlinks for users to reach the file or folder externally. 0.5.0

Errors

Error CodeDetails
MISSING_REQD_ARGUMENT

A required argument is missing or undefined.

MULTPLE_CONFIGS_FOUND

Multiple Record Type Configurations were found for the specified record type. Use the recordTypeConfigId parameter instead of the recordType parameter. 

Example Usage

var params = {
             'recordTypeConfigId':35,
             'recordId':scriptContext.newRecord.id,
             'includeSubFolders':true
           };
           fileapi.getRecordFolderContents(params);

Was this article helpful?