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

Help on controller...



I am trying to display product line items into a visualforce template and i'd like the product to SortOrder the same way they are in Opportunity.


Does anyone know how to make it possible? here is my code...





public class OppsControllerExtension {

    private final Opportunity opps;
    // The extension constructor initializes the private member 
    // variable opps by using the getRecord method from the standard 
    // controller. 
   public OppsControllerExtension(ApexPages.StandardController stdController) {
        this.opps = (Opportunity)stdController.getRecord();

public List<OpportunityLineItem> OppsLicence = [SELECT id, ServiceDate,, TotalPrice_quote__c FROM OpportunityLineItem 
                                         WHERE License_service__c = 1 AND = 
            :System.currentPageReference().getParameters().get('id') Order by SortOrder Asc];

        public integer getLicenceRowNumber() {
            if (OppsLicence.size() >= 1)
            return OppsLicence.size() - 1;
            return 0;
        public list <OpportunityLineItem> getLicenceServicelist () {
        return [SELECT id, ServiceDate, License_service__c, PricebookEntry.Product2.Quote_service_group__c, PricebookEntry.Product2.Quote_service_schedule__c, FROM OpportunityLineItem 
                                         WHERE License_service__c = 1 AND = 
            :System.currentPageReference().getParameters().get('id') Order by SortOrder Asc];


Visualforce page:

<apex:page standardController="Opportunity" showHeader="false" renderAs="pdf" extensions="OppsControllerExtension">  

<apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line">

<apex:panelGrid width="100%" cellspacing="0" cellpadding="0" rendered="{!line.PricebookEntry.Product2.Quote_service_group__c=='Licence'}">
             <apex:outputText value="{!line.PricebookEntry.Product2.Service_name_external__c}" />
             <apex:outputText value="{!line.Quantity}" />
             <apex:outputText value="{!line.PricebookEntry.Product2.Channel_capacity__c}"/>
             <apex:outputText value="{0, number, 0}" >
                 <apex:param value="{!line.RevenueSchedule__c}"/>
             <apex:outputText value="{!line.Currency_ISO_short__c} {!line.TotalPrice_quote__c}" />