1

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

{!IF(ISBLANK(Case.Resolution__c),'',Case.Resolution__c)}

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

2

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.

| improve this answer | |

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.