Internal Salesforce Error seen when using userId as a whoId in renderStoredEmailTemplate method
Last updated 2022-02-10 ·Reference W-3226899 ·Reported By 11 users
In the method Messaging.renderStoredEmailTemplate(templateId, whoId, whatId), If we use userId as the whoId, and execute the method we get an internal server error
- Open Developer console
- Execute the following code in execute anonymous window (Assuming that you have at least one email template, user and account in your org):
EmailTemplate eTemplate = [select id from EmailTemplate LIMIT 1];
User u = [select id from User LIMIT 1];
Account a = [select id from Account LIMIT 1];
Messaging.SingleEmailMessage sEmail = Messaging.renderedStoredEmailTemplate(eTemplate.Id, u.id, a.id);
- Once you execute the code, you will get Internal Salesforce Error message
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.