Saturday, 10 March 2012

Rollup Summary using Trigger

//Rollup summary using trigger on conatct
//This is used for  displaying the number of contacts on account

trigger countingcontacsofacc on Contact (after insert,after delete,after update) {
map<id,list<contact>> mapcontactcount=new map<id,list<contact>>();
map<id,Account> accupdate = new map<id,account>();
for(Account acc:[select id,(select id,name from contacts) from account]){
        accupdate .put(,acc);

for(id c:mapcontactcount.keyset()){
update accupdate.values();


No comments:

Post a Comment

Get the Developer Name for Record Types without SOQL query

Hi, Previously, the developer name was accessible only via SOQL on the RecordType SObject, and not via describe information. Now you can ...