You need to sign in to do that
Don't have an account?
Chris Morrison 7
Apex Output Field from Extension Controller
I am new to development and working on a VF page that will show data from Opportunity, Account and Contact Roles. The standard controller is Opportunity and have tried to build an extension to bring in the parent Account data I need. I started with a list controller and can't get the data to display in an Apex:Output field tag. I get an error that says" Unknown property 'VisualforceArrayList.Account'". It does work when using an apex:PageBlockTable and setting the value of the table to the variable. I don't need or want a table I just want an Output. Here is my controller syntax:
public class DealReviewSheetContactRoleExtension{ public list<Opportunity> Acco{ get; set; } public DealReviewSheetContactRoleExtension( ApexPages.StandardController controller ){ Acco = [SELECT Account.Name, Account.AnnualRevenue, Account.BillingAddress FROM Opportunity WHERE Id = :((Opportunity)controller.getRecord()).Id ]; } }and here is the relevent block on the VF page:
<apex:pageBlock > <apex:pageBlockSection > <apex:outputField value="{!Opportunity.Name}" label="Point Person:"/> <apex:outputField value="{!Acco.Account.AnnualRevenue}" label="Annual Revenue"/>Any guidance would be greatly appreciated!
Complete code
Page
Thanks for your reply. I got the Account information to pull into the page because the standard controller allows for that. I just didn't have my syntax right. Now I am struggling to pull Opportunity Conract Roles into the page as either <apex:outputfield> or <apex:output:text>. As mentioned above it works fine if I assign the variable to PageBlock table but that's not what I need. I did some reading and I am seeing that I need to map the query results to Strings that can be referenced but I can't figure out how to do that. That may not even be the solution. All I need to do is show fields from certain Opportunity Contact records on the page. Can you help me?