I want to monitor for inserts and updates on objects over a specified period of time. I don't know in advance which objects I need to monitor. My constraints are the govenor limits and accuracy. I don't want to miss an event. Recording the events doesn't need to be realtime but it does need to be frequent, i.e. every 5 mins.
From researching this problem I appear to have 3 options. I've discounted number 1 due to concerns about governor limits. I'm now debating between 2 and 3. Any thoughts? ANy other options or issues I haven't considered?
- Take a snapshot of data at the beginning of the period and compare to latest data using dynamic SOQL. This could get messy if the dataset is large.
- Dynamically create triggers on objects of interest via the REST API. Problematic if 1 event is missed - How do I use the Tooling API to create a new Apex Trigger?
- Query the history tables for updates and inserts. Not every object has a history table to query.