Saturday, January 19, 2019

Dynamically Create a Folder with a Sub-folder in the File Cabinet Using SuiteScript

Below is a sample code on how to dynamically create a Folder with a Sub-folder in the File Cabinet using SuiteScript.

function suitelet(request, response){
    var folder = nlapiCreateRecord('folder');
    folder.setFieldValue(
'name','Parent Folder');
    var parentFolderId = nlapiSubmitRecord(folder,true);

    var folder2 = nlapiCreateRecord('folder');
    folder2.setFieldValue(
'name','Sub Folder');
    folder2.setFieldValue(
'parent',parentFolderId);
    var subFolderId = nlapiSubmitRecord(folder2,true);
}

No comments:

Post a Comment