I have a suitelet that allows uploading of files i...
# suitescript
r
I have a suitelet that allows uploading of files into a target folder. I'd like to make the target folder a parameter on the script record. Given there is no Field Type for "folder selection", what is the way people have for allowing someone to select a folder from the document cabinet?
l
this thing you are looking for?
a
@Rick Goodrow You are right, folders are not available as a parameter type, what people normally do is to create a Free-Text field and store the folder internal ID there. You can go by folder name and build logic to search and find that folder ID but that would be weak as you could find multiple folders with the same in the File Cabinet.
r
meh. Okay. Was hoping for a more elegant solution (like actual path traversal) then manually getting the internal ID of the particular folder.
c
The internal ID is the only way to guarantee what you're looking at - a list of dupe folder names is painful.
t
Could track internal ids, name, and parent in a record then build the tree from that.
r
@Craig I wasn't looking for a list of just of folder names. I was hoping that path tree would be included. Something similar to an OS folder list.
but seems NetSuite Document cabinet just isn't build for that kind of traversal, so I'll just use internal ids
a
And once you spend all that time and build a tree then you have two other problems to solve: • Visually show that tree/path in NetSuite UI default drop-down (long names/nested folders, etc) • You still need to perform a search to find your custom record holding the path to find the folder ID. Building a folder tree seems like a trivial task but is not.
r
@alien4u I'm not looking to reinvent the wheel. If NetSuite doesn't natively support folder traversal, then so be it. Internal IDs it is.
šŸ‘ 1
c
If you are trying to limit to specific folders, you could create a custom record type that you maintain that has the path as the name and a folder ID. Then on your suitelet, you can present this list for people and avoid manual folder ID entries. You could even get fancy and tie the custom record to users or groups of users etc... and your suitelet can read that and present folders based on the user. Really depends on if you want the person to specify a unique folder every time or it's going to be static.
r
@creece thanks for the suggestion and the proof of concept. I could do that, but since the folders won't be changing all that often, i'm going to just use an Internal ID. I'll keep that in mind for future folder selection though
šŸ» 1