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
Abhishek Singh 116Abhishek Singh 116 

Unable to fetch the merge field in VisualForce Email Template

I am using a Visualforce email Template. I am unable to fetch merge fields. Below is the code:

<messaging:emailTemplate subject="Volunteer still needed for a shift" recipientType="User" relatedToType="GW_Volunteers__Volunteer_Shift__c">
<messaging:plainTextEmailBody >

Volunteer is still needed for a future shift. Please click below to see the shift.{!relatedToType.Id}


When I try to save it, it gives error like
Error:Unknown property 'String.Id'
Hi Abhishek,
For the link to your custom object, the syntax should be:{!relatedTo.Id}

That should fix it!