in 5 related case records if status__c pilklist is yes and checkbox is true ,then in its parent account ,the custom field no_of_closed_status_in_case__c should get updated as 5 .for this above trigger i am trying it using lists and maps but it is throughing error as
Error: Compile Error: DML requires SObject or SObject list type: Map<Account,Decimal> at line 31 column 11
--
trigger statupdtrecbulk on Case (before insert) {
list<id> accslst = new list<id>();
for(case cs: trigger.new)
{
if(cs.status__c=='yes'&& cs.check_box__c==True)
accslst.add(cs.id);
}
list<account> acc = new list<account>();
acc = [select id,no_of_closed_status_in_case__c,(select id,check_box__c,accountid from cases) from account where id in :accslst];
map<account,decimal> alst = new map<account,decimal>();
for(account ac1l : acc)
{
if(ac1l.no_of_closed_status_in_case__c == NULL)
{
ac1l.no_of_closed_status_in_case__c = 0;
ac1l.no_of_closed_status_in_case__c=ac1l.no_of_closed_status_in_case__c+1;
alst.put(ac1l,ac1l.no_of_closed_status_in_case__c);
}
else
{
ac1l.no_of_closed_status_in_case__c=ac1l.no_of_closed_status_in_case__c+1;
alst.put(ac1l,ac1l.no_of_closed_status_in_case__c);
}
}
update alst;
}