Skip to main content
deleted 56 characters in body
Source Link
Vijay Ganji
  • 6.7k
  • 3
  • 15
  • 31

You won't be able to get the size directly in visualforce pageemail template, iffor that you wantwill have to render some components based onuse the size ofrepeat tag to get the OpportunityLineItems,count and then you will have to declare acan build further logic based on that variable in controller and assign the size of OpportunityLineItems using below code.

public Integer<apex:variable sizeOfOpportunityLineItemsvar="sizeOfOpportunityLineItem" value="{get;set;!0}"/>

and set this variable

sizeOfOpportunityLineItems =<apex:repeat value="{!relatedTo.OpportunityLineItems.size();}">

then you can use this variable in outputPanel to render components

    <apex:outputPanelvariable rendered="var="sizeOfOpportunityLineItem" value="{!sizeOfOpportunityLineItemssizeOfOpportunityLineItem !=+ 01}">"/>
</apex:repeat>
Number of Opportunity Line Items : {!sizeOfOpportunityLineItem}

You won't be able to get the size directly in visualforce page, if you want to render some components based on the size of the OpportunityLineItems, then you will have to declare a variable in controller and assign the size of OpportunityLineItems using below code

public Integer sizeOfOpportunityLineItems {get;set;}

and set this variable

sizeOfOpportunityLineItems = relatedTo.OpportunityLineItems.size();

then you can use this variable in outputPanel to render components

<apex:outputPanel rendered="{!sizeOfOpportunityLineItems != 0}">

You won't be able to get the size directly in visualforce email template, for that you will have to use the repeat tag to get the count and then you can build further logic based on that variable.

<apex:variable var="sizeOfOpportunityLineItem" value="{!0}"/>
<apex:repeat value="{!relatedTo.OpportunityLineItems}">
    <apex:variable var="sizeOfOpportunityLineItem" value="{!sizeOfOpportunityLineItem + 1}"/>
</apex:repeat>
Number of Opportunity Line Items : {!sizeOfOpportunityLineItem}
Source Link
Vijay Ganji
  • 6.7k
  • 3
  • 15
  • 31

You won't be able to get the size directly in visualforce page, if you want to render some components based on the size of the OpportunityLineItems, then you will have to declare a variable in controller and assign the size of OpportunityLineItems using below code

public Integer sizeOfOpportunityLineItems {get;set;}

and set this variable

sizeOfOpportunityLineItems = relatedTo.OpportunityLineItems.size();

then you can use this variable in outputPanel to render components

<apex:outputPanel rendered="{!sizeOfOpportunityLineItems != 0}">