function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
giri rockzzzzgiri rockzzzz 

Error in Trigger on Event object

Hi,
I am trying to update parent event record after the recurring child event records are created.
So, in trigger i am fetching RecurrenceActivityId and query for the  parent event record using RecurrenceActivityId.
During updating the parent event record i am facing internal server error:
An internal server error has occurred An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.

Below is my trigger code:
trigger DemoEvent on Event (after insert) {
  List<Event> evs = Trigger.new;
  Set<id> ids = new Set<id>();
  System.debug('evs = '+evs);
  for(Event e: evs){
      system.debug('RecurrenceActivityId= '+e.RecurrenceActivityId);
      ids.add(e.RecurrenceActivityId);
  }
 
  System.debug('ids = '+ids);
 
  if(ids.size()>0){
      List<Event> ev = [select id,Description from Event where id in:ids];
      System.debug('Event123 = '+ev);
      for(Event e: ev){
          e.Description='test@test.com';
      }
      
      
      update ev;//Facing internal server error here while updating the parent event record.
  }
}   

Aurélien.LavalAurélien.Laval
Hi giri,

First, I think you should verify if the RecurrenceActivityId field is not null (if(e.RecurrenceActivityId != NULL) in the line 7 in your trigger) before to add it in the list (just precaution).

Can you display the error message you have in debug logs please?

Aurélien
giri rockzzzzgiri rockzzzz
Hi Aurélien,
Thanks for your reposne.
I have done null check for RecurrenceActivityId, but even then, i face same error.
In the debug log it is showing FATAL_ERROR | INTERNAL SERVER ERROR . I have added try catch block also but, the error does not go to the catch block.

Regards,
Giri Bhushan