Salesforce provides two key timestamp fields—LastModifiedDate and SystemModStamp—that track changes on records. Although both may appear similar at first glance, understanding their distinct behaviors can help you make better architectural and reporting decisions.
A. LastModifiedDate
What It Is?
- LastModifiedDate captures the date and time when a record was last updated due to a real change in one or more of its fields.
How It Works?
- When a record is first created, LastModifiedDate is set to the same value as CreatedDate.
- Whenever an actual field change occurs—whether by a user through the interface or by an automated process (like a Flow, Process Builder, or Apex)—LastModifiedDate is updated to the current date and time.
- If an update attempt does not result in a changed field (for example, setting a field to the same existing value), LastModifiedDate typically does not change.
Common Uses
- Reporting on Recent Updates: You can filter reports or list views by LastModifiedDate to see which records were most recently changed by your team or by automation.
- Conditional Logic in Automations: You can compare LastModifiedDate against a date or timeframe in a Flow or apex if you only want to process records changed recently.
B. SystemModStamp
What It Is?
- SystemModStamp also tracks the most recent time Salesforce recognizes any update to the record, but it is broader in scope than LastModifiedDate.
How It Works?
- SystemModStamp can change even when no user-facing fields appear to be updated such as internal processes (sharing rule recalculations, roll-up summaries, and other behind-the-scenes tasks).
- It always updates at least as often as LastModifiedDate does but can update more frequently because of these system-driven changes.
Common Uses
- Data Synchronization: Integrations that replicate Salesforce data often rely on SystemModStamp to find all records that might have changed, ensuring no updates slip through.
- Detecting Any Internal Changes: If you need to know whether Salesforce itself has performed a system-level update, SystemModStamp is the more accurate indicator.
C. Key Differences and Implications
- Granularity of Changes:
- LastModifiedDate increments only when a record’s field truly changes.
- SystemModStamp can increment for both field updates and internal processes.
- Usage in Automation:
- If you want to avoid unnecessary updates or triggers, rely more on LastModifiedDate to confirm that data actually changed.
- If you need a guaranteed “catch-all” of any activity (including background jobs), use SystemModStamp.
- Performance Considerations:
- Using LastModifiedDate in queries or flows can sometimes narrow your scope to truly changed records, reducing wasted processing.
- Using SystemModStamp ensures you don’t miss system-initiated updates but may include additional records that haven’t had user-visible changes.
Comment Editor X