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
jaw99KCGjaw99KCG 

Visualforce Email Template Related Info

I have a template for a Custom Object Business_Trip__c with Child relationship to Event via Custom Lookup.
I want to show related meetings.

Template below:

    <p><b>Planned Meetings:</b></p>
    <table border="1" >
        
        <apex:repeat var="cx" value="{!relatedTo.Meetings__r}">
            <tr>
                 <td>Name: {!cx.WhoId}</td>
                 <td>Date: {!cx.ActivityDate}</td>
                 <td>Company: {!cx.Whatid}</td>
                 <td>Subject: {!cx.Subject}</td>
                 <td>Notes: {!cx.Comments_Summary__c}</td>
            </tr>
             
        </apex:repeat>                 
    </table>
    <p />

Provides indecipherable results:

Planned Meetings:
**Name: 003J000001EWnkiIAD**    Date: Thu Jul 09 00:00:00 GMT 2015    **Company: 001J000001btDA7IAM**    Subject: Quarter review

When what I want is:

**Name: Joe Conact** Date: Thu Jul 09 00:00:00 GMT 2015    **Company: AcmeWidgetCo**. Subject: Quarter review

How do I get the names - the Contact and Account names -  from the relation? thanks!

I have tried:

<td>Name: {!cx.Who}</td> - Causes big error on test send

<td>Name: {!cx.WhoId.name}</td> - gets Error: Unknown property 'String.name'    

<td>Name: {!cx.WhoId__r.name}</td> 

and
<td>Name: {!cx.Who__r.name}</td>

Both get -     Error: Invalid field WhoId__r for SObject LookedUpFromActivity    
Best Answer chosen by jaw99KCG
Keyur  ModiKeyur Modi
Hi,
If we see the simple quesry on task it will be like
SELECT id,subject,who.name FROM task    // Here in place of whoId i used who.name
so in your case you can also try with {!cx.who.Name}

please let me know if this will help,

Thanks,
Keyur Modi
 

All Answers

Keyur  ModiKeyur Modi
Hi,
If we see the simple quesry on task it will be like
SELECT id,subject,who.name FROM task    // Here in place of whoId i used who.name
so in your case you can also try with {!cx.who.Name}

please let me know if this will help,

Thanks,
Keyur Modi
 
This was selected as the best answer
jaw99KCGjaw99KCG
Excellent, thanks.