You need to sign in to do that
Don't have an account?
Cross object display field on Visualforce page
I have a lookup method in my controller extension for a custom object to the Campaign.Type field of Campaign.
my visualforce page references the custom object controller and Extension.
How do I reference this field on the page?
Excerpts are:
Extension -
private Trip_Report__c tripReport;
private Campaign campaignInfo;
// get display data
if (tripReport.Campaign__c != null) {
campaignInfo = TripRptManager.getCampaign(tripReport.Campaign__c);
}
in The Utility Lib referenced above -
// Display fields
public static Campaign getCampaign(Id campaign){
return [SELECT
Id
,Name
,Type
FROM
Campaign
WHERE
Id = :campaign
];
}
Page -
<apex:page standardController="Trip_Report__c" extensions="TripRptExt" showHeader="false">
<apex:outputField value="{!campaignInfo.Type }" />
The ERROR
Error: Unknown property 'Trip_Report__cStandardController.campaignInfo'
I also tried !relatedTo.Campaign__r.Type and get the error on 'relatedTo'
Any ideas? Thanks
All Answers
You have your variable CampaignInfo set to private and it has no getters or setters, so the VF page can't access the variable.
Replace this:
With this: