+ Start a Discussion

Error occurred trying to load the template for preview: Apex CPU time limit exceeded. Please try editing your markup to correct the problem.

I am getting this error when trying to open one of my email template for preview. Can any one tell me why this error is coming and how I can debug this error?
This usually means that you are pulling a large amount of data into the template, or are carrying out a *lot* of processing server side in order to generate the email.  I'd have the developer console open when previewing and see if the logs can point at the bottleneck.

I have also seen this happen due to a salesforce problem, where a VF page that typically rendered in 2 seconds suddenly started taking minutes and timing out.  In this situation it was just a waiting game until Salesforce resolved the problem,.