• Fan18
  • NEWBIE
  • 0 Points
  • Member since 2020

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

Good day,

On below trigger, my Insert and Update works. Please assist in an after delete trigger:

trigger calcClaim on Claim__c (after Insert, after Update, after Delete){
    
    set<Id> OccIds = new set<Id>();
    integer count = 0;
    for(Claim__c cl: Trigger.new)
    {    
        decimal temp = 0.0;
        try{temp = Trigger.old[count].Initial_Estimate__c;}
        Catch(exception e)
        {}
        if(cl.Initial_Estimate__c != temp)
        {
            OccIds.add(cl.Occurrence__c);
        } else
            if(Trigger.isDelete){
            /*{for(Claim__c c : trigger.old)
                system.debug(trigger.old);
                OccIds.add(cl.Occurrence__c);}*/
              count++;        
    }
    List<RK_Occurrence__c> occs  = ([SELECT id FROM RK_Occurrence__c where Id in :OccIds]);
    system.debug(occs);
    
    OccurenceClaimCalculator.calculateOcc(occs);
    
    }

  • February 03, 2020
  • Like
  • 0

Good day,

On below trigger, my Insert and Update works. Please assist in an after delete trigger:

trigger calcClaim on Claim__c (after Insert, after Update, after Delete){
    
    set<Id> OccIds = new set<Id>();
    integer count = 0;
    for(Claim__c cl: Trigger.new)
    {    
        decimal temp = 0.0;
        try{temp = Trigger.old[count].Initial_Estimate__c;}
        Catch(exception e)
        {}
        if(cl.Initial_Estimate__c != temp)
        {
            OccIds.add(cl.Occurrence__c);
        } else
            if(Trigger.isDelete){
            /*{for(Claim__c c : trigger.old)
                system.debug(trigger.old);
                OccIds.add(cl.Occurrence__c);}*/
              count++;        
    }
    List<RK_Occurrence__c> occs  = ([SELECT id FROM RK_Occurrence__c where Id in :OccIds]);
    system.debug(occs);
    
    OccurenceClaimCalculator.calculateOcc(occs);
    
    }

  • February 03, 2020
  • Like
  • 0