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
Mattias NordinMattias Nordin 

Loop opportunity product line items from OpportunityLineItems on an visual force page

Hi,

 

I have created a visualForce page that displays information from different objects in sales force (copied to the opportunity object via formulas).

 

Instead of adding the products via a related list i would prefer to build my own. I need to show different columns then i have on the opportunty.

 

<p><apex:relatedList list="OpportunityLineItems" pageSize="1000"/></p>

 

How can you loop the line items in any other way?

forcedotcomforcedotcom

Hi Mattias - I think you might want to look at the <apex:repeat> controller... example below. Please let me know if I've misunderstood what you're trying to do...

 

<!-- Page: -->
<apex:page controller="repeatCon" id="thePage">
<apex:repeat value="{!strings}" var="string" id="theRepeat">
<apex:outputText value="{!string}" id="theValue"/><br/>
</apex:repeat>
</apex:page>

/*** Controller: ***/
public class repeatCon {

public String[] getStrings() {
return new String[]{'ONE','TWO','THREE'};
}
}
Mattias NordinMattias Nordin

Thanks...

 

I follow you so far (have seen that example in the help texts) but i'm not sure how to build an array of products. Can you give me an example of a controller that does that?

 

Im talking about the opportunity products. :smileysurprised: