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

Visualforce Email Template - Navigating Lookup Relationships

I've got a custom object which has a lookup relationship to a case object.  I have a visualforce email alert  template in which I want to reference {!relatedto.RelatedCase__c.CaseNumber} .  The problem is that the {!relatedTo.RelatedCase__c} returns a string containing the objectID of the case and will not allow me to traverse through to the CaseNumber.  How might I accomplish this?



Many Thanks,





You'd normally use the __r suffix to follow the relationship:


try {!relatedto.RelatedCase__r.CaseNumber}