Is there any utility methods in Salesforce that evaluate a formula expression in the form of String? The reason I need this is I'm building my own custom Lightning component to send Email. This component should be able to retrieve Classic Email Templates and render accordingly. However user's can defined formula expressions for example


I want to be able to read Email Templates and be able to convert all formula fields defined into the evaluated values.

1 Answer 1


Have you considered Messaging.renderStoredEmailTemplate? It takes a template ID and automatically generates the template without actually sending the email. Alternatively, you can use Messaging.renderEmailTemplate to provide a "template" that has not been saved, using the "who" and "what" targets for the template.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.