Example use case using Batch Mode/Document Request Object and customer goal is to generate 2,000+ receipts: 

  1. Could setup a Process Builder under Contact object that when box is checked on Contact record (example checkbox could be “Send Receipt”), this will trigger the Process Builder automation that creates new Document Request record. The document request record is a link between Document Action and your record (Contact in this example).
  2. Process Builder automation then creates new Document Request record. The document request record is a link between Document Action and your record (Contact in this example).
  3. Scheduled RS Document batch job runs on the background every 4-6 minutes and is looking for any Document Requests with the Status = New. Then it executes the Document Action for these requests, generates Documents and marks the status to “Completed”.
  4. The Scheduled Batch Job can only process 20 records at a time. Then it waits another 4-6 minutes to process next 20 records in the queue.
  5. Currently, the RS Document process keeps processing all the Document Requests that were created and are in status “New” (and with this example would need to go through several batches to create receipts from  2,000+ records). In order to process to the next batch of Document Requests, batch mode needs to complete all the previous Requests that are in the queue.