You need to sign in to do that
Don't have an account?
Renato Solu
Button works in sandbox, but not in production.
I have created a custom button to send an email to a contact in an Opportunity. In sandbox, this works fine. But when I deployed it to production, it stopped working, and SF is throwing me an INVALID_FIELD_WHEN_USING_TEMPLATE error.
System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_FIELD_WHEN_USING_TEMPLATE, When a template is specified, the plain text body, html body, subject, charset, and "treatBodiesAsTemplate" may not be specified : [].
However, I do not set any of those in my code. The things I set in my SingleEmailMessage instance are:
System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_FIELD_WHEN_USING_TEMPLATE, When a template is specified, the plain text body, html body, subject, charset, and "treatBodiesAsTemplate" may not be specified : [].
However, I do not set any of those in my code. The things I set in my SingleEmailMessage instance are:
- setSaveAsActivity(false);
- setWhatId(Id);
- setTargetObjectId(Id);
- setOrgWideEmailAddressId(String);
- setBccAddresses(String[]);
- setTemplateId(Id)