• Preeta B Y
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi,

This is my Trigger but I want to make class instead of trigger and then call trigger with it. 

trigger caseClose on Case (before insert) {
    
    for (Case myCase : Trigger.new){
       
        List<Case> LatestCase =[SELECT Id
                          FROM Case
                          WHERE CreatedDate = Today
                          AND Contact.Id =:myCase.ContactId];
        if(LatestCase.size()>=2){
        myCase.Status = 'Closed';
        }
    }

}