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
Dchris222Dchris222 

Two object controllers on the same page

Hey guys, I have problem making a page that is requested  by the uppers. This is my first project and I am really struggling with it.

 

The page will allow us to query both opportunities and trade ins at the same time.  It would be able to search on the following field from each

Opportunity:
Close date
Equipment state

Modality

 

Trade In:
DeInstallation date
Equipment state
Modality

 

It should display the result on one page in two separate grids.  The dates should be a date range.  And the equipment state and modality should be optional.  

 

 I have been told this will involve creating a custom visual force page with a custom apex controller, but I have no clue how to even code it. 

 

Any help would be extremly appreciated!

 

Chris

 

 

osamanosaman

Start with the Visualforce pages developer and Apex Language Reference guide.

 

Thanka

 

Osama

Dchris222Dchris222

Ok this is what I have so far. Can i use what i have done so far and create an extension to bring in the other object?

 

<apex:page standardController="Account" extensions="????">
 
    <apex:pageBlock title="Hello {!$User.FirstName}">
        You are displaying information from the {!account.name} account and a separate contact
        that is specified by a query string parameter.
    </apex:pageBlock>   
    <apex:pageBlock title="Opportunities">
        <apex:dataTable value="{!account.Opportunities}" var="opportunity" cellPadding="4" border="1">
              <apex:column >
               <apex:facet name="header">Opportunity Name</apex:facet>
                {!opportunity.Name}
              </apex:column>
              <apex:column >
               <apex:facet name="header">Close Date</apex:facet>
                {!opportunity.CloseDate}
              </apex:column>
              <apex:column >
                <apex:facet name="header">Equipment state</apex:facet>
                  {!opportunity.Equipment_State__c}
              </apex:column>
              <apex:column >
                <apex:facet name="header">Modality</apex:facet>
                 {!opportunity.Equipment_State__c}
              </apex:column>
        </apex:dataTable>
     </apex:pageBlock>          
   <apex:detail subject="{!$CurrentPage.parameters.cid}" relatedList="false" title="false"/>
</apex:page>

 

I really just need some guidence on the best way to create an apex class extension for my specific situation. The example of the extension in the reference guide is extremely simple and doesn't really point me in the right direction.

 

Any help you can provide would be appreciated.

 

Chris

EIE50EIE50

H Chris,

 

Just a thought, can't you develop a component separately with its own controller and then include the component in your VF page which has its own controller. In this way you can leavarage 2 different controllers at a time.

 

Thanks

Pradeep_NavatarPradeep_Navatar

You can do this controller with extension:

 

<apex:page controller="cls_foropportunity" extensions="cls_for tradein" sidebar="false" showheader="false">

 

you can call more than one controller in extension attribute by this way.

 

 <apex:page controller="cls_HOCgenric" extensions="controller1, controller2"/>