Wednesday, February 27, 2019

Get the name of a Folder via script

To get the name of the folder we can use the nlapiLoadRecord and get the value of the name field.

Below is a sample code that gets the folder name of a specific file in your file cabinet.

function getFolderName(){

 var file = nlapiLoadFile(8401); //8401 is the internal id of one of your files in your file cabinet
 var folderid = file.getFolder();
 var folderObj = nlapiLoadRecord('folder', folderid);
 var foldername = folderObj.getFieldValue('name');
 nlapiLogExecution('DEBUG','Folder Name',foldername);

}

No comments:

Post a Comment