Salesforce any certification 100% PASS contact us : malakondaiahexams@gmail.com
Salesforce Certifications
- Salesforce Certified Administrator
- Salesforce Certified Advanced Administrator
- Salesforce Certified CPQ Specialist
- Salesforce Certified Marketing Cloud Administrator
- Salesforce Certified Platform App Builder
- Salesforce Certified Sales Cloud Consultant
- Salesforce Certified Service Cloud Consultant
- Salesforce Certified Community Cloud Consultant
- Salesforce Certified Einstein Analytics and Discovery Consultant
- Salesforce Certified Field Service Lightning Consultant
- Salesforce Certified Marketing Cloud Consultant
- Salesforce Certified Pardot Consultant
- Salesforce Certified Platform Developer I
- Salesforce Certified Platform Developer II
- Salesforce Certified JavaScript Developer I
- Salesforce Certified Marketing Cloud Developer
- Salesforce Certified B2C Commerce Developer
- Salesforce Certified Marketing Cloud Email Specialist
- Salesforce Certified Pardot Consultant
- Salesforce Certified Pardot Specialist
- Salesforce Certified Data Architecture and Management Designer
- Salesforce Certified Sharing and Visibility Designer
- Salesforce Certified Integration Architecture Designer
- Salesforce Certified Identity and Access Management Designer
- Salesforce Certified Development Lifecycle and Deployment Designer
- Salesforce Accredited B2B Commerce Administrator (100%Pass)
- Salesforce Accredited B2B Commerce Developer (100%Pass)
Sunday, 17 March 2013
Saturday, 16 March 2013
countofcontacts
trigger Countofcontacts on Contact (after insert,after delete)
{
set<id> accid=new set<id>();
list<contact> contactlist=new list<contact>();
list<contact> listcon=new list<contact>();
list<account> acclist=new list<account>();
list<account> listAcc=new list<account>();
map<id,integer> mapCount=new map<id,integer>();
if(trigger.isinsert)
{
for(contact con:trigger.new)
{
accid.add(con.accountid);
}
}
if(trigger.isdelete)
{
for(contact con:trigger.old)
{
accid.add(con.accountid);
}
}
acclist=[select id,name from account where id in:accid];
contactlist=[select id,name,accountid from contact where accountid in:accid];
for(account acc:acclist)
{
listcon.clear();
for(contact c:contactlist)
{
if(c.accountid==acc.id)
{
listcon.add(c);
mapCount.put(c.accountid,listcon.size());
}
}
}
if(acclist.size()>0)
{
for(Account a:acclist)
{
if(mapCount.get(a.id)==null)
a.Count_Of_Contacts__c=0;
else
a.Count_Of_Contacts__c=mapCount.get(a.id);
listAcc.add(a);
}
}
if(listAcc.size()>0)
update listAcc;
}
{
set<id> accid=new set<id>();
list<contact> contactlist=new list<contact>();
list<contact> listcon=new list<contact>();
list<account> acclist=new list<account>();
list<account> listAcc=new list<account>();
map<id,integer> mapCount=new map<id,integer>();
if(trigger.isinsert)
{
for(contact con:trigger.new)
{
accid.add(con.accountid);
}
}
if(trigger.isdelete)
{
for(contact con:trigger.old)
{
accid.add(con.accountid);
}
}
acclist=[select id,name from account where id in:accid];
contactlist=[select id,name,accountid from contact where accountid in:accid];
for(account acc:acclist)
{
listcon.clear();
for(contact c:contactlist)
{
if(c.accountid==acc.id)
{
listcon.add(c);
mapCount.put(c.accountid,listcon.size());
}
}
}
if(acclist.size()>0)
{
for(Account a:acclist)
{
if(mapCount.get(a.id)==null)
a.Count_Of_Contacts__c=0;
else
a.Count_Of_Contacts__c=mapCount.get(a.id);
listAcc.add(a);
}
}
if(listAcc.size()>0)
update listAcc;
}
Subscribe to:
Posts (Atom)