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
Dvisha TDvisha T 

Unknown property Error on myopportunities

Hi,

Am having similar error am new to visualforce and apex do correct my code thanks in advance.
Error: Unknown property 'myOpportunities' referenced in OppExt

public with sharing class OppExt {
     public List<Opportunity> myOpportunities { get; private set; }

     public OppExt(){
         myOpportunities = [ SELECT Id, Name, Account.Name,StageName,Amount,CloseDate
                 from Opportunity 
                 WHERE OwnerId = :UserInfo.getUserId()];

    }
}
<apex:page>
<apex:repeat value="{!myOpportunities}" var="opp" >
   <apex:outputlink value="/{!opp.Id}">{!opp.Name}</apex:outputlink><br/>
</apex:repeat>
</apex:page>
Magesh Mani YadavMagesh Mani Yadav
Hi Dvisha,

the controller attribute is not defined on the <apex:page tag. Try this should work
<apex:page controller="OppExt" >

 
Dvisha TDvisha T
Hi Magesh,

Thank you for your help.
But somehow the logic dis not work for me.~Hope you can help on my requirement.
Display a link to an opportunity object in my VF page rather than just the name.
Display opportunity name as a link in a VF page that expand and collapse its product related details.
 
Magesh Mani YadavMagesh Mani Yadav
Hi Dvisha,
I hope the question you have asked initially has been fixed. If you have any other issue which is not related to this then create another post for that not in this post. so that people who get stuck in similar issue will get the answer from this post.