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
ag_forceag_force 

Read access denied in objects using Email Template and Customer Portal User

Hello,

 

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 user. We are using the
Customer Portal Manager Custom user license.


Below is the email template:

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

My guess is that the {!relatedTo.Id} triggers the problem because it access the object Timesheet_Period__c.
I've done already the following:
- Sharing rules already grant to All Customer Portal Users and still the problem occurs.
- In profile settings, the are no settings granting the customer portal manager custom to access Timesheet_Period__c.