public void cdperiod(){
List<Adchrg> lstRec = new List<Adchrg>();
if(MapSlctChg != null){
List<Adchrg> rec = MapSlctChg.get('Recurring');
for(Adchrg chg : rec){
chg.amount = ((Decimal.valueOf(chg.originalchg)/ maxDays) * minDays).setScale(2);
lstRec.add(chg);
}
MapSlctChg.put('Recurring',lstRec);
update MapSlctChg.values();
}
system.debug(MapSlctChg);
}
Add a comment
|
1 Answer
This error means exactly what it says. An update
DML statement requires a list of Sobject
types, such as Account
, Contact
, etc. You are providing a List<List<Adchrg>>
, which is not the correct type.
Adchrg
does not appear to be an Sobject, so you cannot perform DML on it in any case. Your Map
appears to have the type Map<String, List<Adchrg>>
. Hence, its values()
method returns List<List<Adchrg>>
.