function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
WEN JIEWEN JIE 

Error about when use component in a email template

Hi,

 

I have a compotent display some info for one sobject. And for this component I have a custom controller to select info about this object by record id. I also create an attribute for this component to get record id from template.(I test it works well)

 

Then I create a visualforce email template. I set recipientType as "User" and relatedToType as my sobject. Then invoke that component in <messaging:attachment renderas="pdf">.

 

Then I saw this error message:

Error occurred trying to load the template for preview: List has no rows for assignment to SObject. Please try editing your markup to correct the problem.
 

But when I run my code this template can be invoke and I can get the mail with that pdf attachment.(production a)
And in another production environment I run as a real user (not administrator), I saw the same error.(production b)
Error occurred trying to load the template for preview: List has no rows for assignment to SObject. Please try editing your markup to correct the problem.
 

I think maybe my component custom controll didn't get the record id from template. And I really don't know why code can run in production a but can't work in production b.
 
Thank you!!!