• Chhavi Singhal 13
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
My Trigger Code Here: 


trigger ContactCountTrigger on Contact (After insert, After Delete, After Undelete,after update) {

Set<id> setAccountId=new Set<id>();
if(Trigger.isInsert || Trigger.isUndelete || Trigger.isUpdate){
for(Contact con:Trigger.New){
setAccountId.add(con.AccountId);

}
}
if(Trigger.IsDelete){
for(Contact con:Trigger.old){
setAccountId.add(con.AccountId);

}
}
List<Account> listAcc=[select id,noOfContact__c,(Select id from Contacts)from Account where id in:setAccountId];
for(Account acc:listAcc){
acc.noOfContact__c=acc.contacts.size();

}
update listAcc;
}

 
Create a Visualforce page that uses a custom controller to display a list of cases with the status of 'New'.The page must be named 'NewCaseList'.
The custom controller Apex class must be named 'NewCaseListController'.
The 'NewCaseListController' Apex class must have a publically scoped method named 'getNewCases'.
The 'getNewCases' Apex method should have the return type of 'List' and return a list of case records with the ID and CaseNumber fields and filtered to only have a status of 'New'.
The 'NewCaseList' Visualforce page must use an apex:repeat component which is bound to 'newCases'.
The apex:repeat component must refer to the var attribute as 'case'.
Within the apex:repeat component, bind a apex:outputLink component to the ID of the case so that the page directs the user to the detail page of the respective case record