I like to create a report folder via Apex trigger/class is it possible.
Thanks in advance
I like to create a report folder via Apex trigger/class is it possible.
Thanks in advance
It is not possible if you try doing it directly e.g.:
insert new Folder(Name = 'MyFolderName', Type = 'Report');
because even as a System Administrator you will get the error:
DML not allowed on Folder
There is an undelivered idea about this Please Allow DML ops from Apex for MailMergeTemplate, BrandTemplate, and Folder.
But if this functionality is important enough, you can accomplish it by invoking the Metadata API from your Apex. (That would have to be asynchronous from a trigger via @future.) A good starting point on how to do that is Introduction to calling the Metadata API from Apex.
Is this possible.
– Mangoski Apr 22 '14 at 15:50