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

Read access denied in Email Template

Hello Community,


I created a vf email template that will be sent when a portal user hits a submit button in the Portal. I'm encountering the following error:


SendEmail failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, Read access denied for Timesheet_Period__c.


I'm wondering why this error occurs whereas other functionality in the portal connected to the object Timesheet_Period__c is working fine. I tried accessing the vf page inside salesforce and it works fine, the problem is in portal.


Below is the email template: 


<messaging:emailTemplate subject="Timesheet Approval" recipientType="User" relatedToType="Timesheet_Period__c">
<messaging:htmlEmailBody >
<c:EmailApprover period="{!relatedTo.Id}"/>


My guess is that the {!relatedTo.Id} triggers the problem. I'm not sure what's the step should I make in addressing this problem.


Any help will be appreciated.

Afzal MohammadAfzal Mohammad

Two things you need to check.


1. Make sure your profile has access to that object.

2. Check the field level security of that field and make sure your profile has read permission.


Hope that helps.




Hello Afzal,


Thanks your reply. I checked the profile settings of Customer Portal Manager Custom profile, and the problem is that it does not show the setting that grants the profile access to custom object. Other profiles have that settings to grant custom object. 

Is this really the case for portal users? please advise.




Sharing rules also already grant to All Customer Portal Users for the said custom object and still the problem occurs.


Was this ever resolved? I am running into an identical problem trying to tie a Visualforce email template to a Contact. This seems to be a problem specifically with Visualforce templates as it works fine with a regular email template. I am also running in a Portal. 

I just ran into this same error almost two years later - Visualforce email template, related to custom object, with a Site/portal user. So no, never resolved. Still says UNKNOWN_EXCEPTION, Read access denied for CustomObject__c