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
MrBrianMrBrian 

Unable to query event record in console, despite it showing in SFDC.

Hi All,

I have a unique problem that I think might be a bug. Last year, I used data loader to create a bunch of events for some historic data. Today, I created a trigger that counts these events that meet criteria. However, I noticed that many of the imported events were not getting counted by the trigger at all. Took the ID for one of these uncounted events and did a query for the event record in the console with the ID taken from the URL: 
select Id from Event where Id ='EVENTIDHERE'
And low and behold, no records where returned.

After fudging around with the record for a while, I was able to make it queryable by changing the StartDate and EndDates to the year 2015 (where before the field was in 2010). Oddly, after making this change, I can query the ID in console, even if I set the StartDate and EndDate years back to 2010.

Has anyone had a similar expereince? I am wordering if there was some kind of bug with the mass upsert of Events, or if there is something that I am not understanding about archiving? I cannot tell if these even are archived, because I cannot query them, so I do not have access to the field "isArchived".

Any ideas?

Thanks,
Brian
 
logontokartiklogontokartik
Yes. you are right, the event might have been archived. Please see the below to get more understanding on how archiving on Events and Tasks work.

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_guidelines_archive.htm
MrBrianMrBrian
Thank you! I was able to make my trigger work by adding this to the end of the event query:
AND isDeleted = FALSE ALL ROWS

Appreciate it!