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
gaisergaiser 

DML not allowed on setup entity (trying to create EmailTemplate )

I am trying to create EmailTemplate from Apex Class (in Sandbox) but system complains in the line where I do
------------
insert mytemplate;
------------
Error message states: Compilation error: DML not allowed on setup entity

Apex Developer's Guide in section "SObjects That Do Not Support DML Operations" does not mention anything about EmailTemplate and hence I assume that creation of EmailTemplate is absolutely legal.

Is it a bug in the documentation or in SFDC Apex Compiler?

Has anyone else experienced similar problem?