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
sunfishettesunfishette 

Tired of failed attempts to display result!

My faithful saviors,

I have tried a dozen different ways of doing the below mentioned by reading through the discussion boards for ideas.  It sounds SO simple, but its very frustrating.

 

I have one VF page.

I have two objects (one standard, one custom)

I want to display a tab panel on my VF page that shows a list on one tab from the standard object, and a list on the second tab from the custom object.

 

I have the list working great for the standard object.  No issues there.  But now I want to display the custom object list, and all I get are errors.  I understand that there is an issue with controllers here, but I am not able to get an effective and clear result from the 9,215 different suggested ways to configure my pages and classes.

 

It doesnt help that I suck at apex.

 

So ... here goes:

<apex:page showHeader="false" sidebar="false" standardController="Opportunity" tabStyle="Opportunity" extensions="getAllRecords">
                                                                  
                 <apex:pageBlock id="block1" mode="detail" rendered="true">
                    <apex:tabPanel selectedTab="MaintenanceRenewals" id="theTabPanel"  tabClass="activeTab" inactiveTabClass="inactiveTab"  width="100%">                    
                        <apex:tab label="Maintenance Renewals" name="MaintenanceRenewals" labelWidth="250px" >
                            <apex:pageBlockSection id="underFive" title="Within 5 Days or Past Due Maintenance Renewals" columns="1" collapsible="false"> 
                               <apex:PageBlockTable value="{!DuePastDue}" var="records" rowClasses="brightRed1,brightRed2"> 
                                    <apex:column value="{!records.CloseDate}" headerValue="Renewal Due By" width="16%"/>
                                    <apex:column headerValue="Manufacturer Name" width="20%">
                                        <apex:outputLink target="URLFOR('//006/e')" value="/{!records.Id}">{!records.Name}</apex:outputLink>
                                    </apex:column>
                                    <apex:column value="{!records.Contract_Owner__c}" headerValue="Contract Owner" width="16%"/>
                                    <apex:column value="{!records.StageName}" headerValue="Stage" width="16%"/>
                                    <apex:column value="{!records.Renewal_Status__c}" headerValue="Renewal Status" width="16%"/>
                                    <apex:column value="{!records.Amount}" headerValue="Renewal Amount" width="16%" />
                                </apex:pageBlockTable>                                 
                             <apex:form >
                                 <input type="button" value="Hide / Unhide Renewals" onClick="collapse('{!$Component.fiveThirty},{!$Component.thirtySixty},{!$Component.over60}');return false;">
                                 </input>
                             </apex:form>
                            </apex:pageBlockSection>                                                                  
                            <apex:pageBlockSection id="fiveThirty" title="5-30 Days Maintenance Renewals" columns="1" collapsible="false"> 
                               <apex:PageBlockTable value="{!FiveThirty}" var="records" rowClasses="red1,red2">
                                    <apex:column value="{!records.CloseDate}" headerValue="Renewal Due By" width="16%"/>
                                    <apex:column headerValue="Manufacturer Name" width="20%">
                                        <apex:outputLink target="URLFOR('//006/e')" value="/{!records.Id}">{!records.Name}</apex:outputLink>
                                    </apex:column>
                                    <apex:column value="{!records.Contract_Owner__c}" headerValue="Contract Owner" width="16%"/>
                                    <apex:column value="{!records.StageName}" headerValue="Stage" width="16%"/>
                                    <apex:column value="{!records.Renewal_Status__c}" headerValue="Renewal Status" width="16%"/>
                                    <apex:column value="{!records.Amount}" headerValue="Renewal Amount" width="16%" />
                                </apex:pageBlockTable>                                    
                            </apex:pageBlockSection>
                            <apex:pageBlockSection id="thirtySixty" title="31-60 Days Maintenance Renewals" columns="1" collapsible="false">
                               <apex:PageBlockTable value="{!ThirtySixty}" var="records" rowClasses="yellow1,yellow2">
                                   <apex:column value="{!records.CloseDate}" headerValue="Renewal Due By" width="16%"/>
                                    <apex:column headerValue="Manufacturer Name" width="20%">
                                        <apex:outputLink target="URLFOR('//006/e')" value="/{!records.Id}">{!records.Name}</apex:outputLink>
                                    </apex:column>
                                    <apex:column value="{!records.Contract_Owner__c}" headerValue="Contract Owner" width="16%"/>
                                    <apex:column value="{!records.StageName}" headerValue="Stage" width="16%"/>
                                    <apex:column value="{!records.Renewal_Status__c}" headerValue="Renewal Status" width="16%"/>
                                    <apex:column value="{!records.Amount}" headerValue="Renewal Amount" width="16%" />
                                </apex:pageBlockTable>
                            </apex:pageBlockSection>
                            <apex:pageBlockSection id="over60" title="61-120 Days Maintenance Renewals" columns="1" collapsible="false">
                                <apex:PageBlockTable value="{!OverSixty}" var="records" rowClasses="green1,green2">
                                   <apex:column value="{!records.CloseDate}" headerValue="Renewal Due By" width="16%"/>
                                    <apex:column headerValue="Manufacturer Name" width="20%">
                                        <apex:outputLink target="URLFOR('//006/e')" value="/{!records.Id}">{!records.Name}</apex:outputLink>
                                    </apex:column>
                                    <apex:column value="{!records.Contract_Owner__c}" headerValue="Contract Owner" width="16%"/>
                                    <apex:column value="{!records.StageName}" headerValue="Stage" width="16%"/>
                                    <apex:column value="{!records.Renewal_Status__c}" headerValue="Renewal Status" width="16%"/>
                                    <apex:column value="{!records.Amount}" headerValue="Renewal Amount" width="16%" />
                                </apex:pageBlockTable>
                            </apex:pageBlockSection>     
                        </apex:tab>
                        <apex:tab label="COMING SOON" name="scorecard" labelWidth="250px" >
                            <apex:pageBlockSection title="New things to come!" columns="1" collapsible="false">
                               
                            </apex:pageBlockSection>
                        </apex:tab>                        
                    </apex:tabPanel>
                  </apex:pageBlock>
                </div>
            </div>
        </div>
    </body>   
</html>
</apex:page>

 I removed all the javascript and css as it was not relevant and took up space.

public class getAllRecords {
    public getAllRecords(ApexPages.StandardController Controller) {
    }  
    //method to get all maint. renewals
    public Opportunity[] getRecordDetail(){
    //declare and instantiate recordList
    Opportunity[]recordList = new List<Opportunity>();
    //SOQL call to get all the records
        recordList = [SELECT Name,
                             Contract_Owner__c,
                             Amount,
                             CloseDate,
                             StageName,
                             Renewal_Status__c
                        FROM Opportunity
                       WHERE AccountId IN 
                            (SELECT AccountId 
                             From User 
                             WHERE username=:UserInfo.getUsername())
                         AND (Stagename = 'Baseline' OR Stagename = 'Review' OR Stagename = 'Execution' OR Stagename = 'Customer Input Required')
                       ORDER BY CloseDate];
       return recordList;
    }
    //method to strip out pastdue to 5 days from close_date
    public Opportunity[] getDuePastDue(){
    List<Opportunity> recordList = getRecordDetail();
    List<Opportunity> pastDueList = new List<Opportunity>();
        for(Opportunity obj:recordList) {
                if(obj.CloseDate < (system.today() +5)) {
                   pastDueList.add(obj);
                }    
        }
    return pastDueList;
    }
    //method to strip out 5-30 days from close_date
    public Opportunity[] getFiveThirty(){
    List<Opportunity> recordList = getRecordDetail();
    List<Opportunity> fiveThirtyList = new List<Opportunity>();
        for(Opportunity obj4:recordList) {
            if((obj4.CloseDate > (system.today() + 5)) && (obj4.CloseDate <= (system.today() + 30)))  {
                fiveThirtyList.add(obj4);
            }
        }
    return fiveThirtyList;
    }
    //method to strip out over 60 days from close date
    public Opportunity[] getOverSixty(){
        List<Opportunity> recordList = getRecordDetail();
        List<Opportunity> overSixtyList = new List<Opportunity>();
            for(Opportunity obj2:recordList) {
                if((obj2.CloseDate <= (system.today() + 120)) && (obj2.CloseDate > (system.today() + 60))){
                    overSixtyList.add(obj2);
                }
            }
    return overSixtyList;
    }    
    //method to strip out 30-60 days from close date
    public Opportunity[] getThirtySixty(){
    List<Opportunity> recordList = getRecordDetail();
    List<Opportunity> thirtySixtyList = new List<Opportunity>();
        for(Opportunity obj3:recordList) {
            if((obj3.CloseDate <= (system.today() + 60)) && (obj3.CloseDate > (system.today() + 30))) {
                thirtySixtyList.add(obj3);
            }
        }
    return thirtySixtyList;
    }  
}

 Now what I need to do us get the custom object list inserted into the "Coming Soon" section.

 

Could someone please give me a code sample to push me in the right direction?  Much appreciated!!

Daniel.ReidDaniel.Reid

Hello sunfishette,

 

Were you able to solve your problem?  If not,  I'm confident we can figure this out, but I could use a little more information on what exactly is going wrong.  You mentioned errors were being returned, if you could list which errors you are seeing, I could more easily help you get to the bottom of this.

 

Daniel Reid
Contact us - We can help!

Salesforce Superheroes
------------------------------
help@salesforcesuperheroes.com
www.salesforcesuperheroes.com
1-888-407-9578 x102