You need to sign in to do that
Don't have an account?
Renato Solu
Invalid fields on single email message, even with the fields not being set
I'm having an issue where Salesforce raises me an exception while trying to send three email messages (using the SingleEmailMessage class).
The exception code is INVALID_FIELD_WHEN_USING_TEMPLATE and it says When a template is specified, the plain text body, html body, subject, charset, and "treatBodiesAsTemplate" may not be specified. It would be a pretty straightforward thing to solve, however I am not setting any of those fields in my code.
In my code, I basically get a Contact Id, an Opportunity Id, and the Opportunity Owner's email address to send the email to. I am setting the email as BCC. Do notice though that I have created similar code to other classes in the organization, and they work just fine (setting a single email message with a template and bcc field).
If it is of any help, I also posted the question to Salesforce StackExchange.
The exception code is INVALID_FIELD_WHEN_USING_TEMPLATE and it says When a template is specified, the plain text body, html body, subject, charset, and "treatBodiesAsTemplate" may not be specified. It would be a pretty straightforward thing to solve, however I am not setting any of those fields in my code.
In my code, I basically get a Contact Id, an Opportunity Id, and the Opportunity Owner's email address to send the email to. I am setting the email as BCC. Do notice though that I have created similar code to other classes in the organization, and they work just fine (setting a single email message with a template and bcc field).
If it is of any help, I also posted the question to Salesforce StackExchange.
As per the documentation, you can't set the BCC addresses when your using template in your email message. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_email_outbound_single.htm