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

DML not allowed on OrgWideEmailAddress

I am trying to create an OrgWideEmailAddress in apex (via an insert in a testmethod) but I'm getting the message "Save error: DML not allowed on OrgWideEmailAddress" on compile. Any ideas on why this create is not being allowed? The OrgWideEmailAddress object specifies supported calls of: create(), delete(), query(), retrieve(), update().



OrgWideEmailAddress newOwea1 = new OrgWideEmailAddress(Address='',DisplayName='TestOwea1');
OrgWideEmailAddress newOwea2 = new OrgWideEmailAddress(Address='',DisplayName='TestOwea1');
insert newOwea1;
insert newOwea2;





Hi Nello.  It's not currently supported, so I've created an Idea for that: 


Please vote!