I need to create a direct link to a folder in the ...
# suitescript
s
I need to create a direct link to a folder in the file cabinet... From what I can tell, it will need to be hard-coded.. URL module barfs on record type 'folder'. -- Has anyone else dealt with linking to folders?
s
you need the folder id
m
and if you need it in edit mode add &e=T to the end
s
yeah use that one mine was wrong 😄
s
Yep, got it... thanks guys~ I see that NetSuite resolves them on a search result, but that link isn't available.. I was hoping I could use 'getText' and it would magically provide the URL.. lol.. instead it's just
null
-- why provide a useful url when you can provide
null
@Michael Pope @sterling_rose
@Michael Pope @sterling_rose This function will return the link to the folder, or direct path to upload a zip for the given folder.
Copy code
/**
 * Get Links to the File Cabinet for a given Folder
 * 
 * @param {string} folderId 
 * @returns {Object} links
 * @param {string} links.link Direct path to folder in File Cabinet
 * @param {string} links.uploadZip Direct path to upload multiple files via .zip for the given Folder
 */
function getFolderLink(folderId) {
    var path = 'https://';
    var domain = url.resolveDomain({ hostType: url.HostType.APPLICATION });
    return {
        link: path + domain + '/app/common/media/mediaitemfolders.nl?folder=' + folderId,
        uploadZip: path + domain + '/app/common/media/importmediabatch.nl?folder=' + folderId
    }
}