Salesforce Asked on November 15, 2021
This is a generic question which I couldn’t find enough data online. I have a batch job that runs once every week. This job updates Contact records based on updates on the parent Account.
Scenario: For instance, if the batch job started executing at 4:00 Am PST. And by scope has almost 100,000 Contacts. One random user opens a Contact record at around 4:01 Am PST, which is already in the batch’s scope but yet to get executed (future batch chunk), and commit to the database.
Questions:
Your records in the execute
block will be stale. You retrieved a Database.QueryLocator
in the start
method, and records will be chunked as if you queried them all at that time. However, these updates from the user will not remove the record from the QueryLocator
either, it will still get chunked eventually. So if you just re-query the records in your execute
block, your batch should work more or less intuitively.
Answered by Adrian Larson on November 15, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP