I have a visualforce page, related to the Opportunity Object. There is a lookup field (Influencer1__c), which looksup to the Contact object, name. How can i create another field to show the contacts title?

<td valign="top" width="120"  bgcolor="#DCE1E9"><apex:outputField value="{!StrategicSales__c.Influencer1__c}" > 

  • (1) what's the relationship between Opportunity and Strategic_Sales__c ? (2) and is the VF page using the Opportunity StandardController with or without a controller extension? Or is it a custom controller (not an extension)? – cropredy Jun 22 '16 at 22:48
  • opportunity standardcontroller – Andy Ux Jun 24 '16 at 16:43
  • I set up a master child rel from strategic sales to opportunity – Andy Ux Jun 24 '16 at 16:44
  • (1) Strategic Sales is master to Oppo detail? (2) Strategic Sales has lookup to Contact? Or Oppo has lookup to Contact? – cropredy Jun 24 '16 at 18:02

Being a contact is parent here, you can display Contact fields by using ( __r ) relationship.

For example, the Title field of contact can be display on opportunity as, (Object (Object_Instance).Influencer1__r.Title

And you need to query these fields in apex method by using similar notation.

| improve this answer | |
  • Opportunity is the related object, so i didn't thinks this would work, but it does, thank you. – Andy Ux Jun 24 '16 at 18:18

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.