function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
narender.gupta01narender.gupta01 

How to create folder programmatically?

Hi,

 

I'm trying to create a folder programmatically, but it's showing a save Error: DML not allowed on Folder.

 

I read somewhere that you can "create a folder in SFDC via setup". (http://boards.developerforce.com/t5/Apex-Code-Development/Creating-folders-using-apex/m-p/383265#M68616)

 

I couldn't find any help / documentation on that. Please help me on how can I do that. Any pointers / code will be highly appreciated.

 

Thanks

Narender

vishal@forcevishal@force

Creating a folder via setup means doing it using the salesforce UI and not Apex. Apex cannot create folders for you, it is simply not allowed. 

 

Go to Documents Tab and there you'll have a 'Create a New Folder' option, that's where you can create your folders from using Setup.