You need to sign in to do that
Don't have an account?
Niamh L
Display Related Custom Field on VF Page
Hi,
I am creating a Visualforce page and want to display the pet breed available from the pet custom object. I have a field on the case object called Pet Name (Pet__c) which is a lookup field to the pet object to select the pet.
But on the VF page I want to display the breed and age of the pet too, but i get the error Unknown property 'String.Pet_Breed__c'
See code for page below:
<tr>
<td valign="top" style="padding:3px;"></td>
<td height="30" width="300" valign="top" style="padding:3px;">Breed of Pet:</td>
<td width="300" valign="top" style="padding:3px;">{!Case.Pet__c.Pet_Breed__c}</td>
</tr>
Any help appreciated.
I am creating a Visualforce page and want to display the pet breed available from the pet custom object. I have a field on the case object called Pet Name (Pet__c) which is a lookup field to the pet object to select the pet.
But on the VF page I want to display the breed and age of the pet too, but i get the error Unknown property 'String.Pet_Breed__c'
See code for page below:
<tr>
<td valign="top" style="padding:3px;"></td>
<td height="30" width="300" valign="top" style="padding:3px;">Breed of Pet:</td>
<td width="300" valign="top" style="padding:3px;">{!Case.Pet__c.Pet_Breed__c}</td>
</tr>
Any help appreciated.
In order to access related object’s data you need to append __r instead of __c. In case of standard object you don’t need to append __r. They are accessible using simple name. In your case you can access your data as given below :
{!Case.Pet__r.Pet_Breed__c}
Can you please Let me know if it works or not and also If you face any problems!!!
If it works don't forget to mark this as a best answer!!!
Thanks,
Raj
All Answers
In order to access related object’s data you need to append __r instead of __c. In case of standard object you don’t need to append __r. They are accessible using simple name. In your case you can access your data as given below :
{!Case.Pet__r.Pet_Breed__c}
Can you please Let me know if it works or not and also If you face any problems!!!
If it works don't forget to mark this as a best answer!!!
Thanks,
Raj
Niamh