function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Beginner problem, unable to output rows from SOQL query to <apex:repeat>

I'm getting this error:


Description	Resource	Path	Location	Type
Save error: Unknown property 'OpportunityStandardController.getLines'	/SFDC/src/pages	line 0 save problem

 Here is my visual force page:

<apex:page standardController="Opportunity" extensions="AlexHelloWorld">
    <apex:form >
        <apex:pageBlock title="Edit account for {!$User.FirstName}">
            <apex:pageMessages />
            <apex:pageBlockButtons >
            <apex:pageBlockSection >
                <apex:outputText value="Test - {!retVal}">
            <apex:pageBlockSection >
                <apex:outputText value="OppId - {!}" />
                <apex:outputText value="UserId - {!$User.Id}" />
            	<apex:repeat value="{!getLines}" var="line" id="theRepeat">
            			<td valign="top"><apex:outputField value="{!line.Id}" /></td>
            			<td valign="top"><apex:outputField value="{!line.OpportunityId}" /></td>
            			<td valign="top"><apex:outputField value="{!line.PricebookEntryId}" /></td>
            			<td valign="top"><apex:outputField value="{!line.Quantity}" /></td>

 Here is my controller:

public with sharing class AlexHelloWorld {

    public boolean 	showFedEx{get;set;}
    public String	mystr{get;set;}
    public Id		opportunityId{get;set;}
    //public Opportunity opportunity{get;set;}
    public Decimal retVal{get;set;}
    //Main controller class
    public AlexHelloWorld(ApexPages.StandardController controller)
    	mystr = [SELECT Email from User where Id =:Userinfo.getUserId()].Email;
        showFedEx = true;
        retVal = 5*5;
    public List<OpportunityLineItem> getLines()
		List<OpportunityLineItem> oli = [SELECT Id, OpportunityId, PricebookEntryId, Quantity FROM OpportunityLineItem where id =:System.currentPageReference().getParameters().get('id')];
		return oli;    	


Any ideas?

Best Answer chosen by Admin (Salesforce Developers) 

Replace {!getLines} by {!Lines}


(Salesforce adds 'get' automatically)

All Answers


Replace {!getLines} by {!Lines}


(Salesforce adds 'get' automatically)

This was selected as the best answer

Thanks!  I'm reading the Dev book and I wish they'd have put that in...