1

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:

Name: {!cx.Who} - Causes big error on test send

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

Name: {!cx.WhoId__r.name}

and Name: {!cx.Who__r.name}

Both get - Error: Invalid field WhoId__r for SObject LookedUpFromActivity

1

WhoId is a polymorphic field in Event Object which can point to Contact or Lead.

So just like AccountId in Contact Object where you can use Contact.Account.Name, you can use Who.Name to retrieve the Name of Contact or Lead associated with the Event.

Hope it helps.

  • Yes, I tried many iterations, but who.name and what.name weren't it. thanks - helps me understand better. – jaw999 Jul 10 '15 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.