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
vasea pepenevasea pepene 

How to display the OpportunityLineItemSchedule content into a VisualForce page

Hi All,
Does anyone know if a standard Controller or Extention exists for pulling the revenue schedule list, and can be used in a VF page?
The ultimate goal is to have the product revenue schedule reflected on the opportunity layout page. Any other solution will be appreciated too!

Thanks!
Mohammad Alazzouni 6Mohammad Alazzouni 6
I would love to know this too! My client has Professional Edition and cannot use custom controllers. This has been a headache but at the same time, it's not worth upgrading for this one VF page.
Sukanya BanekarSukanya Banekar
Hi Vasea,
You can use standard controller to have opportunity line item schedule on opportunity layout page.
Below is the VF page just pass opportunity id while running this page e.g. /apex/OpportunitySchedule?id=0069000000pTgG3
<apex:page standardController="Opportunity" action="{!getOLIS}" tabStyle="Opportunity" extensions="OpportunityScheduleExtension">
 <apex:form >
 <apex:sectionHeader title="Opportunity" subtitle="{!Opportunity.Name}"/>
 <apex:pageBlock >
     <apex:pageBlockSection >
         <apex:outputField value="{!Opportunity.Name}"/>
         <apex:outputField value="{!Opportunity.CloseDate}"/>
         <apex:outputField value="{!Opportunity.StageName}"/>
     </apex:pageBlockSection>
  </apex:pageBlock>
     <apex:pageBlock title="Schedule">
     <apex:pageBlockTable value="{!lstOLIS}" var="lst" >
          <apex:column headerValue="Date" value="{!lst.ScheduleDate}"/>
          <apex:column headerValue="Revenue" value="{!lst.Revenue}"/>
          <apex:column headerValue="Comment" value="{!lst.Description}"/>
     </apex:pageBlockTable>
     </apex:pageBlock>
 </apex:form>
</apex:page>
Below is the Extension
public with sharing class OpportunityScheduleExtension {
    Opportunity objOpp;
    public list<OpportunityLineItemSchedule> lstOLIS {get;set;}
    public OpportunityScheduleExtension(ApexPages.StandardController controller) {
        this.objOpp= (Opportunity)controller.getRecord();
    }
    
   
    public void getOLIS(){
        lstOLIS = new list<OpportunityLineItemSchedule >();
        system.debug('objOpp---------->'+objOpp);
        for(OpportunityLineItemSchedule objOLIS:[Select Id, ScheduleDate, Revenue,
                                                 OpportunityLineItem.Product2.Name,
                                                 Description
                                                 from OpportunityLineItemSchedule 
                                                 where OpportunityLineItem.OpportunityId =:objOpp.Id] ){
            lstOLIS.add(objOLIS);                                             
        }
    }    
}
I hope this helps you.

Thanks,
Sukanya

 
Ash Pate 1Ash Pate 1
Hey Sukanya- Thanks for this was very helpful! Curious if you know how I would write an apex class to summerize this information by month? For example if I have two products with schedules on the same opportunity in the same month, how can I go about summing the revenue together under just one month? I have the SOQL code tested but having trouble with the APEX class. Any auggestions? 

select OpportunityLineItemSchedule.OpportunityLineItem.OpportunityID, ScheduleDate, sum(Revenue) Revenue from OpportunityLineItemSchedule where OpportunityLineItemSchedule.OpportunityLineItem.OpportunityID=:objOpp.Id group by scheduledate, OpportunityLineItemSchedule.OpportunityLineItem.OpportunityID order by scheduledate