API Status Code Changes

New error codes have been added related to sending email messages and rendering email templates, and one error code has been changed.

New Error Codes

These error codes can be returned by sendEmail().

EMAIL_ADDRESS_BOUNCED
Emails to one or more recipients have bounced. Check email addresses to make sure they are valid.
EMAIL_OPTED_OUT
A single email message was sent with the REJECT setting in the optOutPolicy field to recipients that have opted out from receiving email. To avoid this error, set the optOutPolicy field to another value.

These error codes can be returned by the new renderEmailTemplate() call or by sendEmail().

EMAIL_TEMPLATE_FORMULA_ERROR
The email template is invalid and can’t be rendered. Check the template for incorrectly specified merge fields.
EMAIL_TEMPLATE_MERGEFIELD_ACCESS_ERROR
You don’t have access to one or more merge fields in this template. Contact your Salesforce administrator to request access.
EMAIL_TEMPLATE_MERGEFIELD_ERROR
One or more merge fields don’t exist. Check the spelling of field names.
EMAIL_TEMPLATE_MERGEFIELD_VALUE_ERROR
One or more merge fields have no value. Update the records before sending the email to provide values.
EMAIL_TEMPLATE_PROCESSING_ERROR
The merge fields in this email template can’t be processed. Ensure that your template body is valid.

Changed Error Codes

UNABLE_TO_LOCK_ROW
The error message now contains the IDs of the records that couldn’t be locked, when available.