How to get the “true” LastModifiedDate of an object with the Salesforce API
-
05-07-2021 - |
Question
I have a Custom Object in Salesforce that users routinely access and edit within the Salesforce online environment. Lets call them RootObjects to keep things simple.
I am attempting to retrieve the "LastModifiedDate" the RootObjects using the Salesforce API. The goal is to determine when they were last edited by a user, however, I've hit a snag.
These objects have a Lookup relationships other custom objects. Lets call these LinkedObjects. When I insert a LinkedObject using the Salesforce API, it appears to effect the LastModifiedDate of the RootObjects, even thought I am not directly editing them the RootObject.
This is causing an issue whereby I cannot determine when a user last edited something vs. when a new related object was inserted.
Is there another system field that I can use that only reports the "true" last modified date? At this point, I am considering making a custom date field that is updated with a trigger whenever an object is saved, however, I would like to avoid that if necessary.
Solution
As many who commented suspected, there was a Workflow in place that was modifying the objects. I am going with a "Save" Workflow that will update a custom date/time field. Thanks for all the suggestions!
OTHER TIPS
Try to use ModifiedById field.