+ Start a Discussion
James HayesJames Hayes 

IsClosed=FALSE is not pulling in Open opps

Hey All, 

When using this apex class 
public class MyOpportunityController3{
    public List<Opportunity> oppList{get;set;}
    public MyOpportunityController3(ApexPages.StandardSetController controller) {
        oppList = new List<Opportunity>();
        for(Opportunity opp : [SELECT id,name,amount,stagename,closedate,ownerid FROM Opportunity
                                WHERE owner.id=:userinfo.getuserid() AND isClosed=False]) {
            oppList.add(opp );


It does not pull in the open opportunities when I tie it to an embedded VF page.  The VFP pulls in all opportunities.  I am not sure what I am missing here.  THe VF code is below.  Any assistance would be appreciated!
<apex:page standardController="Opportunity" recordSetVar="ops" sidebar="false" extensions="MyOpportunityController3">
<apex:form >
    <apex:pageBlock >
    <apex:pageBlockSection >
    <apex:pageBlock Title="List of Opportunities">
        <apex:pageblockTable value="{!ops}" var="o">
            <apex:column >
                <apex:commandLink value="{!o.Name}" reRender="refresharea">
                    <apex:param name="OpportunityID" value="{!o.ID}"/>
                    <apex:param name="OpportunityName"  value="{!o.Name}" />
            <apex:column value="{!o.Amount}"/>
            <apex:column value="{!o.StageName}"/>
            <apex:column value="{!o.Closedate}"/>
        <apex:inlineEditSupport event="ondblClick"
            showOnEdit="saveButton,cancelButton" hideOnEdit="editButton"/>

        <apex:pageBlockButtons >
            <apex:commandButton value="Edit" action="{!save}" id="editButton"/>
            <apex:commandButton value="Save" action="{!save}" id="saveButton"/>
            <apex:commandButton value="Cancel" action="{!cancel}" id="cancelButton"/>
    <apex:pageBlock title="{!$CurrentPage.parameters.OpportunityName}" id="refresharea">
        <apex:detail subject="{!$CurrentPage.parameters.opportunityID}" relatedList="false"/>

Hi James,

You fetched the opportunity list in your controller. But in your VF page you are iterating the recordset variable which will not give you the list in your controller. Iterate 'oppList' in your VF Page instead of 'ops'.
<apex:pageblockTable value="{!oppList}" var="o">