Batch Receipt Logs and Background Jobs
This article explains how Dryad Receipting runs large jobs in the background and how to follow them with Batch Receipt Logs.
It covers what each log shows, how one run's logs fit together, how to stop a job, and what to do when a job looks stuck.
Why Jobs Run in the Background
Creating receipts, building PDFs, merging, emailing and printing can involve thousands of records. Salesforce limits how much one request can do, so the app splits this work into background jobs that handle a few records at a time (the Receipt Batch Size setting).
Each job writes a Batch Receipt Log. Open them from the Batch Receipt Logs tab. A job keeps running if you close the page that started it.
What a Log Shows
| Field | What it tells you |
|---|---|
| Action | What the job does (see the table below). |
| Status | "In Progress", "Complete", "Complete with Errors" or "Aborted". |
| Records Targeted | How many records the job set out to process. |
| Records Processed | How many it has processed successfully so far. |
| % Complete | Records Processed divided by Records Targeted. |
| Results | Error messages and other details. |
| Parent BRL | The "Create Receipts" log of the same run, so a run's steps can be followed from one log. |
| Dryad Mailer only: the Email record of the send. | |
| Printed | Merge logs only: ticked once the merged PDF has been set as printed. |
The report "Receipts in a Batch Receipt Log" lists the receipts a log worked on. See Receipt Reports.
Log Actions
| Action | Written by |
|---|---|
| Create Receipts | Batch Receipts, the New Receipts button on a list view, the scheduled job, and your own automation when it creates many receipts at once. |
| Create PDFs | Every job that creates receipts, and also the Create Missing PDFs button. |
| Merge PDFs | Merging receipts for printing. The merged PDFs are attached to this log. |
| Print Receipts | Setting receipts as printed. |
| Email Receipts | Emailing receipts, through Salesforce or Dryad Mailer. |
| Preview Report | The Create Preview Report button on the Batch Receipts screens. |
| Refresh Indexed Fields | App Utilities > Refresh Indexed Fields, when Enable Index Optimization is on. |
Older Action Values
Earlier versions stored the PDF actions as "Create .pdfs" and "Merge .pdfs". Logs created before you upgrade keep those values, and they are no longer used for new logs. After upgrading, an administrator should:
- Go to Setup > Object Manager > Batch Receipt Log > Fields & Relationships > Action and click Replace. Replace "Create .pdfs" with "Create PDFs", then "Merge .pdfs" with "Merge PDFs".
- On the same field, deactivate "Create .pdfs" and "Merge .pdfs" if they are still active.
- Update any reports, list views or automation that filter on the old values.
Until step 1 is done, merged PDFs created before the upgrade and not yet printed don't appear under Print merged receipts, and a "Create .pdfs" log still "In Progress" isn't recognized by the scheduled job.
How One Run's Logs Fit Together
A run of Batch Receipts or the scheduled job usually writes several logs:
- a "Create Receipts" log for the receipts,
- a "Create PDFs" log for their PDFs, and
- when the run continues, "Email Receipts", "Merge PDFs" or "Print Receipts" logs.
The later logs point to the first one through Parent BRL. Records a job works on are stamped with its log ID. That's how the app later finds "the receipts from this run", for example to email or print them.
PDFs Are Created in Parallel
To finish sooner, a large "Create PDFs" job is split into segments that run at the same time. The PDF Segments setting sets how many: 3 by default, at most 5.
Each segment is a Batch Receipt Log Segment record under the log, with its own status and counts.
- The log's Records Processed adds up its segments.
- The log is finished when no segment is still "Queued" or "In Progress".
- If any segment failed to create some PDFs, the log ends "Complete with Errors" and Results says how many failed.
Stopping a Job
Open the log and click Abort Job, then confirm. You need the Receipt User or Receipt Admin permission set.
- The job's background work is stopped and the log is set to "Aborted".
- Work already done is kept. Receipts that were created stay created, and their gifts show as "Receipted".
- If the job's progress screen is still open in Batch Receipts, it shows the step as "Aborted" and the Finish button works. Steps that hadn't started, such as creating PDFs, aren't waited for.
- Each log records the exact background job it belongs to in Job Id, from the moment the job is queued, so a job can be aborted even before it starts.
- A job that is already "Complete" or "Aborted", or whose log has no Job Id, can't be aborted. The action says "Cannot abort the job because the status is …".
Running Jobs at the Same Time
Two runs that create, email or merge the same records at once could get in each other's way, so Batch Receipts won't start a run while a job of the same kind is queued or running anywhere in the org, whoever started it.
It checks when you open the action and again when you click to start it, and shows a message asking you to wait for that process to finish.
| Action on the Batch Receipts tab | Blocked while this is queued or running |
|---|---|
| Creating receipts (any type, including giving summaries) | Any job that creates receipts or PDFs: Batch Receipts, the New Receipts button on a list view, the scheduled job, and the Create Missing PDFs button |
| Emailing receipts | Any job that emails receipts through Salesforce, including the scheduled daily email |
| Merging receipts | Any merge job |
- The check looks at the background jobs themselves, not at log statuses, so a log wrongly left "In Progress" never blocks anyone.
- Different kinds of runs don't block each other. Dryad Mailer sends don't count as email jobs.
- The Batch Receipts tab and the New Receipts button on a list view are checked; the list view button checks when you click Create Receipts. The Email Receipts and Merge Receipts buttons on a Receipt list view are checked too, when you click them and again when you confirm. The buttons on records don't check, but their running jobs still block the others.
- Two people who click to start in the same second could both get through.
The scheduled job has its own check: it skips its run while a "Create Receipts" or "Create PDFs" log created today is still "In Progress".
When a Job Looks Stuck
Sometimes a background job ends without updating its log, for example when it is stopped from Setup or hits a Salesforce error it can't catch. Its log stays "In Progress".
- Logs are closed automatically. Each time someone opens a create, email or merge action on the Batch Receipts tab, the app checks the most recent "In Progress" logs created since the start of yesterday. A log whose job was aborted becomes "Aborted". A log whose job ended without updating it becomes "Complete with Errors", and Results says "This job stopped before it finished. Some records may not have been processed."
- PDF segments are repaired automatically. Each time PDFs are created, at the start of each scheduled job run, and with the check above, the app looks for PDF segments whose background job has already ended. It closes them, counts their missing PDFs as failed, and completes the log.
- Older logs stay "In Progress". Logs created before yesterday, and logs with no Job Id, aren't closed automatically. Abort them with the Abort Job button. Until a stuck "Create Receipts" or "Create PDFs" log from today is closed, it stops the scheduled job from running that day.
Troubleshooting
| Symptom | Check |
|---|---|
| A log stays "In Progress" for a long time | Look in Setup > Apex Jobs. If its jobs are still running, wait. If they have ended, open a create, email or merge action on the Batch Receipts tab to close it, or click Abort Job if it was created before yesterday. |
| "Complete with Errors" with "This job stopped before it finished." | The job ended without updating its log, and the app closed it. Check which records were processed with the report "Receipts in a Batch Receipt Log", and run the action again for the rest. |
| Batch Receipts says receipts are already being created, emailed or merged | A job of the same kind is queued or running. Find it in Setup > Apex Jobs and wait for it to finish. |
| The scheduled job didn't run today | A "Create Receipts" or "Create PDFs" log from today is still "In Progress". Wait for it to finish, or abort it if it's stuck. |
| "Complete with Errors" | Read Results for the reason, such as an inaccessible field or a daily limit. For PDF logs, open the segments to see which ones failed, then run the Create Missing PDFs button. |
| Records Processed is lower than Records Targeted | Some records failed, or were skipped because they no longer met the rules when the job reached them. Check Results. |
| Receipts exist but have no PDF | Their "Create PDFs" log failed or was aborted. Run the Create Missing PDFs button. |
| The Abort Job button says it can't abort the job | The job is already "Complete" or "Aborted", or the log has no Job Id. |
| The Abort Job button doesn't appear | Check that the button is on the Batch Receipt Log page layout. |