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
,ID
FROM Pricebook2
WHERE Name='Support Renewal' AND IsActive=true];
List <PricebookEntry> supportRenewal = [SELECT ID
,ProductCode
,UnitPrice
FROM PricebookEntry
WHERE ProductCode Like 'MAR%'
AND Pricebook2Id in: Pbook2Id];
List <marWrapper> wrapMar = new List<marWrapper>();
for(PricebookEntry pbEntryMar : supportRenewal)
{
wrapMar.marWrapper(pbEntryMar.ID,pbEntryMar.UnitPrice,pbEntryMar.ProductCode);
}
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)
{
this.marId=marId;
this.marUnitPrice=marUnitPrice;
this.marProductCode=marProductCode;
this.productCode=marProductCode.substring(4);
}
}
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:
wrapMar.marWrapper(pbEntryMar.ID,pbEntryMar.UnitPrice,pbEntryMar.ProductCode);
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.