• Shaun Ripley
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
I tried to create folder via apex code
      
      code:

        Folder fold=new Folder();
        fold.AccessType='Shared';
        fold.DeveloperName=UserInfo.getUserName();
        fold.AccessType='Shared';
        fold.Name='testfolder';
        fold.Type='Report';
        insert fold;

i got the error dml not allowed on folder.



I'm trying to figure out if a folder can be created using apex.  The following code does not work:

 

Folder newFolder = new Folder(Name=folderName,Type='Document',AccessType='Public'); insert newFolder;

 

 Apparently DML is not allowed on folders.  Any thoughts on this?

 

Thanks!