You need to sign in to do that
Don't have an account?

Does anyone know why aapex:outputField is not working in visualforce email template?
Hi,
I have seen a strange behavior using visualforce email template.
Earlier, i used apex:outputField in vf email template and it worked perfectly.
Now, when i tried to modify email emplate, below error message is shown
Error occurred trying to load the template for preview: Read access not found for <<Custom Object>>.
Does anyone know why is this happening?
Sounds like someone amended the read access for that custom object in Profiles. Or possibly Field Level Security and/or Sharing Rules.
In any case I think your template saved OK, its just the preview that is broken.
Thanks for the reply.
I have seen, nothing in profiles on that custom object has been change.
Even FLS has not been changed.
It used to work fine earlier before the Winter'11 release.
I will suggest, you to create a sample email template and use apex:outputField on custom object and see whether you are also getting the same error message.
Can you please respond back?
Hey,
I have use <apex:outPutText> tag successfully in brand new template
there is no such issue
Thanks,
Bala
Hey Imran,
I just read your problem. It is the Read Permission problem only. Try few things which I am mentioning below and try:
1) Go to the reffered profile - say System Admin or on whatever you are working on. Click Edit and go to the Object you are using and if any other related Object is also used check that also and see if it has Read Edit permissions or not. Or try selecting Modify All permissions for those objects and then try.
2) If everything is checked in above scenario and still it donot work, then go to Create -> objects -> Whatever Object You are using then go to field level Security and check the fields you are using in for Email Template, check the security and make Non Readable and visible and then try again.
Try these two things and I hope it will solve your issue.
Regards,
CKumar
Thanks,
I tested it, the system admin has full permissions on all the custom objects as well as FLS settings set to true, but still the same error persists.
It will be of a great help if you can try out creating a sample vf email template and use apex:outputField and see whether you will succeed.
If you have any other suggestions, please let me know.
Anyway, thanks for your help.
Can you send me the code of the VF template you have written? So that I can see what you are doing.
Regards,
Ckumar
Below is the code,
Please let me know if anything is wrong.
<messaging:emailTemplate subject=" {!relatedTo.User_ID__r.name}" recipientType="User" relatedToType="Scon__c" >
<messaging:htmlEmailBody >
<html>
<body>
<p>Dear {!recipient.name},</p>
<table border="0">
<tr>
<td>
Number:
</td>
<td>
<apex:outputField value="{!relatedTo.Name}"/>
</td>
</tr>
<tr>
<td>
Name:
</td>
<td>
<apex:outputField value="{!relatedTo.Doc_Name__c}"/>
</td>
</tr>
<tr>
<td>
Date Generated:
</td>
<td>
<apex:outputField value="{!relatedTo.GDate__c}"/>
</td>
</tr>
<tr>
<td>
Date Viewed:
</td>
<td>
<apex:outputField value="{!relatedTo.DateViewed__c}"/>
</td>
</tr>
<tr>
<td>
Date Accepted:
</td>
<td>
<apex:outputField value="{!relatedTo.DateAccepted__c}"/>
</td>
</tr>
<tr>
<td>
Documents Accepted:
</td>
<td>
<apex:outputField value="{!relatedTo.Documents__c}"/>
</td>
</tr>
</table>
<br/>
<p>Thanks</p>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
Try using outputText instead of outputField
Thanks for that.
I already replaced apex:outputField with outputText.
Can you tell why its not working?
Try using single Name field and remove other fields from the html body, and then try again ?
Hey Imran,
can you send your gmail id so that we can chat online and can resolve this issue ASAP?
Regards,
Ckumar