2

I'm trying to access a contact object field through a related object's lookup field. Billing_contact__c below (2nd td) is an entity object lookup field that has a related contact record. When I reference the Address__c field in the contact object, I get the following error:

Error: Unknown property 'String.Address__c'

Any idea why? And how can I accomplish my goal of displaying this contact object field?

        <apex:repeat value="{!entities}" var="r">
            <tr>
              <td>{!r.Name}</td>
              <td>{!r.Billing_Contact__c.Address__c}</td>
              <td>{!r.Email_1__c}</td>
              <td>{!r.Phone_1__c}</td>
              <td><apex:outputfield value="{!r.Inactive__c}"></apex:outputfield></td>
              <td>{!r.CreatedBy.Name}</td>
          </tr>
         </apex:repeat>
9

Relationships need to be navigated with the "r" extension, e.g.

r.Billing_Contact__r.Address__c

The "c" is the field itself, which is just an ID (hence the error about String); the "r" is the relationship.

  • Great, thank you. – geeljire Mar 17 '13 at 15:52

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.