Problem:
I want to backup salesforce data into local database for history tracking/backup. So I store the SystemModStamp of last fetched record. In my org in a split second so many records gets created. Now I am storing the SystemModStamp of the last record that I pull. In next pull, I apply the filter as
PULL ALL THE SF RECORDS WHERE SystemModStamp > STORED_LAST_PULL_SYSTEM_MOD_STAMP
Now lets say, my program got interrupted because of some technical reason and I was able to pull 200 records of 500 records which got created at that exact second. If I run my program again then based on above logic I could loose 300 records.
Questions:
- This problem could be minimized to very greater level if somehow, I start getting milliseconds factor in SystemModStamp, so is there any way to get that in salesforce?
See below, whenever I pull records, I don't see any factor in milliseconds part of DateTime fields.
- What could be other approach that I could take to perform such activity without loosing any data?
Note: I want to sync (create history in backup database ) as SystemModStamp changes when record gets updated.
LastModifiedDate
, not in the context of theSystemModStamp
. TheSystemModStamp
includes updates initiated by system activity. I don't know if it is applied before or after the commit.