I have the following incomplete(this is how far I've gotten so far before the error occurs) method:

    public List<assetswrapper> getAssets() //
List<Pricebook2> Pbook2Id = [SELECT Name
                                FROM Pricebook2 
                                    WHERE Name='Support Renewal' AND IsActive=true];

List <PricebookEntry> supportRenewal = [SELECT ID
                                            FROM PricebookEntry 
                                                WHERE ProductCode Like 'MAR%'
                                                    AND Pricebook2Id in: Pbook2Id];

List <marWrapper> wrapMar = new List<marWrapper>();

for(PricebookEntry pbEntryMar : supportRenewal)

which makes use of the following wrapper class:

public class marWrapper
    ID marId{get;set;}
    double marUnitPrice{get;set;}
    String marProductCode{get;set;}
    String productCode{get;set;}

    public void marWrapper(ID marId, Decimal marUnitPrice, String marProductCode) 

so the error that I get is:

Save error: Method does not exist or incorrect signature: [LIST].marWrapper(Id, Decimal, String). I can tell that the error happens in the following line:


All that the getAssets() method is doing so far is:

  • Create a pricebook2 list and a pricebookentry list from which I'm gathering relevant data.

  • Create a new marWrapper list which will be filled with all the data from the PricebookEntry list and add an extra column to the marWrapper list.

Let me know if more clarification is needed. I feel like I may have butchered the explanation a little.

1 Answer 1


The problem you have here is that you are trying to call the method marWrapper on a list of marWrappers. What you should be doing instead is adding an instance of your marWrapper to the List of marWrappers. For example:

for(PricebookEntry pbEntryMar : supportRenewal){
    marWrapper wrapper = new marWrapper();

Perhaps you meant to make your marWrapper method a constructor (remove the void and you're there) which would have allowed you to do this?

for(PricebookEntry pbEntryMar : supportRenewal){
    wrapMar.add( new marWrapper(pbEntryMar.ID,pbEntryMar.UnitPrice,pbEntryMar.ProductCode) );

Or perhaps you wanted a static 'factory' type method?:

for(PricebookEntry pbEntryMar : supportRenewal){
    wrapMar.add( marWrapper.newInstance(pbEntryMar.ID,pbEntryMar.UnitPrice,pbEntryMar.ProductCode) );

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .