Skip to main content

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. It is written for Salesforce administrators and the staff who run receipting.

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​

FieldWhat it tells you
ActionWhat the job does (see the table below).
Status"In Progress", "Complete", "Complete with Errors" or "Aborted".
Records TargetedHow many records the job set out to process.
Records ProcessedHow many it has processed successfully so far.
% CompleteRecords Processed divided by Records Targeted.
ResultsError messages and other details.
Parent BRLThe "Create Receipts" log of the same run, so a run's steps can be followed from one log.
EmailDryad Mailer only: the Email record of the send.
PrintedMerge 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.

Log Actions​

ActionWritten by
Create ReceiptsBatch Receipts, the New Receipts button on a list view, the scheduled job, and your own automation when it creates many receipts at once.
Create .pdfsEvery job that creates receipts, and also the Create Missing .pdfs button.
Merge .pdfsMerging receipts for printing. The merged .pdfs are attached to this log.
Print ReceiptsSetting receipts as printed.
Email ReceiptsEmailing receipts, through Salesforce or Dryad Mailer.
Preview ReportThe Create Preview Report button on the Batch Receipts screens.
Refresh Indexed FieldsApp Utilities > Refresh Indexed Fields, when Enable Index Optimization is on.
Download External File, Delete External FileOlder receipt .pdfs stored outside Salesforce (see External File Fields).

How One Run's Logs Fit Together​

A run of Batch Receipts or the scheduled job usually writes several logs:

  1. a "Create Receipts" log for the receipts,
  2. a "Create .pdfs" log for their .pdfs, and
  3. 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".
  • 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 …".

Note: After aborting a "Create .pdfs" job, run Receipt Settings > App Utilities > Create Missing .pdfs to finish the receipts that have no .pdf yet.

Running Jobs at the Same Time​

Batch Receipts doesn't check whether the same kind of job is already running. Two runs that create, email or merge the same records at once can get in each other's way, so start a run only when no other run of the same kind is "In Progress". Check the Batch Receipt Logs tab first, especially before year-end runs.

The scheduled job does 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".

  • .pdf segments are repaired automatically. Each time .pdfs are created, and at the start of each scheduled job run, 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.
  • Other logs stay "In Progress". Abort them with the Abort Job button. Until then, a stuck "Create Receipts" or "Create .pdfs" log from today stops the scheduled job from running that day.

Troubleshooting​

SymptomCheck
A log stays "In Progress" for a long timeLook in Setup > Apex Jobs. If its jobs are still running, wait. If they have ended, start any .pdf job (such as the Create Missing .pdfs button) for a .pdf log, or click Abort Job for other logs.
The scheduled job didn't run todayA "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 TargetedSome records failed, or were skipped because they no longer met the rules when the job reached them. Check Results.
Receipts exist but have no .pdfTheir "Create .pdfs" log failed or was aborted. Run the Create Missing .pdfs button.
The Abort Job button says it can't abort the jobThe job is already "Complete" or "Aborted", or the log has no Job Id.
The Abort Job button doesn't appearCheck that the button is on the Batch Receipt Log page layout.