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
Daniel Khan 21Daniel Khan 21 

Get Name of Opportunity Line Item without Opportunity Name

Hi all,

I've done some APEX based on an idea of Deepak Anand (https://success.salesforce.com/answers?id=90630000000hTXHAA2).

Actually everything works, but on the generated .pdf the name of the Opportunity is shown in the line of the product nameHow to remove opp name in product name line?.

I only want to have the name of the product. What am I missing?  THANKS FOR ANY ADVICE!

My APEX Class:

public class OpptyGenPDFExtension {

    public List<OpportunityLineItem > OLI {get; set;}
    
        public OpptyGenPDFExtension(ApexPages.StandardController controller) {
        String oliIDs = ApexPages.currentPage().getParameters().get('oliid');
          
           if(!String.isBlank(oliIDs)){
            Set<Id> oliIdSet = new Set<Id>();
            for(String oliId : oliIDs.split(',')){
                oliIdSet.add(oliId);
            }             
            OLI = 
                [
                  SELECT Name,ProductCode,Quantity FROM OpportunityLineItem 
                  WHERE
                        Id IN :oliIdSet ];               
}      
                                
                
        }
    }
 

My VF:

<apex:page standardController="Opportunity" extensions="OpptyGenPDFExtension" renderAs="pdf">
    <table width="100%" style="font-family: Arial, Helvetica, sans-serif; border-collapse: collapse;"
        cellpadding="5">
        <tr>
            <td colspan="4">
                Hardware Anforderungen für neues System
            </td>
            <td> Printed on: {!DAY(TODAY())}.{!MONTH(TODAY())}.{!YEAR(TODAY())}
            </td>
        </tr>
        <tr>
            <td colspan="4" style="font-size: x-large; font-weight: bold">
                Opportunity Name: {!Opportunity.Name}
            </td>
        </tr>
        <tr>
            <td align="left" style="color: #808080; ">
                
            </td>
            <td style="font-weight: bold">
                
            </td>
            <td align="left" style="color: #808080; ">
                
            </td>
            <td style="font-weight: bold">
                
            </td>
        </tr>
        
        <tr>
            <td align="left" style="color: #808080; border-right-style: solid; border-right-width: thin;
                border-right-color: #ddb929;">
                Opportunity Number
            </td>
            <td style="font-weight: bold">
                {!Opportunity.Opportunity_Nummer__c}
            </td>
            
        </tr>
        
        <tr>
            <td align="left" style="color: #808080; border-right-style: solid; border-right-width: thin;
                border-right-color: #ddb929;">
                Hardware configured by
            </td>
            <td style="font-weight: bold">
                {!Opportunity.System_konfiguriert_von__c}
            </td>
            
        </tr>
        
        <tr>
            <td align="left" style="color: #808080; border-right-style: solid; border-right-width: thin;
                border-right-color: #ddb929;">
                Account Name
            </td>
            <td style="font-weight: bold">
                {!Opportunity.Account.Name}
            </td>
            
        </tr>
        
        
        
        <tr>
            <td colspan="4">
                &nbsp;
            </td>
        </tr>
        <tr>
           
        </tr>
        <tr>
            
            <td style="font-weight: bold">
                
            </td>
            <td align="right" style="color: #808080; ">
                
            </td>
            <td style="font-weight: bold">
                
            </td>
        </tr>
        <tr>
            <td align="right" style="color: #808080; ">
                
            </td>
            <td style="font-weight: bold">
                
            </td>
            <td align="right" style="color: #808080; ">
                
            </td>
            <td style="font-weight: bold">
                
            </td>
        </tr>
    </table>
    <br/><br/>
    
    
    <apex:outputPanel rendered="{!OLI != NULL}">
        <table width="100%" style="font-family: Arial, Helvetica, sans-serif; border-collapse: collapse;"
            cellpadding="5">
            <tr>
                <td colspan="6" style="font-weight: bold; border-bottom-style: solid; border-bottom-width: thick;
                    border-bottom-color: #ddb929;">
                    Line Item
                </td>
            </tr>
            <tr>
                <td style="font-weight: bold; background-color: #FFFFCC;">
                    Product Name
                </td>
                <td style="font-weight: bold; background-color: #FFFFCC;">
                    Product Code
                </td>
                <td style="font-weight: bold; background-color: #FFFFCC;">
                    Quantity
                </td>
                
            </tr>
            <apex:repeat value="{!OLI}" var="opl">
                <tr id="{!opl.Id}">
                    <td>
                        {!opl.Name}
                    </td>
                    <td>
                        {!opl.ProductCode}
                    </td>
                 
                    <td>
                        {!opl.Quantity}
                    </td>                
                </tr>            
            </apex:repeat>
        </table>    
    </apex:outputPanel>
</apex:page>
Daniel Khan 21Daniel Khan 21
I think it depends on line 128 of the VF code. But dunno the right path to solve problem.