Script Sample to create a folder under a specified folder.

If you want to create a folder under a parent folder, you have to include N/Record module. Then create a record of type folder. Set the name to the folder. Set the parent of that folder.

  const createFolder = (name) => {
    let folder = record.create({  //creating a folder
      type: record.Type.FOLDER,
      isDynamic: true,
    });
    folder.setValue("name", foldername); //setting foldername
    folder.setValue("parent",parentfolderinternalid); //setting parent folder
    return folder.save();
  };

  

Leave a comment

Your email address will not be published. Required fields are marked *