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
jf317820jf317820 

Fetching RecurringEvents records

Select Id, (Select Id, Subject, Location, ActivityDateTime From RecurringEvents) From Event

This query works in the Eclipse Schema Explorer, but I cant iterate the innerquery in an Apex trigger...any ideas?

Thanks
jpizzalajpizzala
Are you receiving an error or are you just unable to get the values from RecurringEvents? If the former, please post the error. If the latter, how are you trying to access the RecurringEvent data?

Keep in mind that the inner query will be returned as an array so you will have to do something like the following:
Code:
// loop over returned Events
for( Event event : eventResults ) {

 // loop over all RecurringEvents associated with the Event
 for( RecurringEvent recEvent : event.recurringEvents ) {
   
  // do stuff with the RecurringEvent info

 }

}

 HTH



Message Edited by jpizzala on 04-07-2008 05:11 PM

Message Edited by jpizzala on 04-07-2008 05:14 PM
jf317820jf317820
when i try

Code:
for (Event myEvents : [Select id, (Select Id, Subject, Location, ActivityDateTime From 
RecurringEvents) From Event where id = :e.id])
{
for (RecurringEvent re: myEvents.RecurringEvents) {

}
}

 
it gives me "Save Error: Invalid Type: RecurringEvent...


jf317820jf317820



Message Edited by jf317820 on 04-07-2008 09:22 PM
jf317820jf317820
It looks like this is the proper format:

Code:
for (Event myEvents : [Select id, (Select Id, Subject, Location, ActivityDateTime 
From RecurringEvents) From Event where id = :e.id])
   { 
        for (Event re: myEvents.RecurringEvents) 
        {
           System.debug(re.subject);
        }
   }