Scheduled Job
This article explains the scheduled receipt job: how to set it up, which gifts it creates receipts for, and which receipts it emails. It is written for Salesforce administrators and the staff who run receipting.
What the Scheduled Job Does
The scheduled job receipts new single gifts automatically, without anyone opening Batch Receipts. Each run:
- finds recent Gift Transactions that are ready for a single receipt,
- creates their receipts and .pdfs, and
- if you chose the Create receipts and email them option, emails the receipts issued today or yesterday that are waiting to be emailed.
It is meant for day-to-day receipting of new gifts. Consolidated receipts, gift commitments, back-dated gifts and year-end runs are still done with Batch Receipts.
Setting Up the Job
Open the Receipt Settings tab and select Scheduled Jobs. You need the Receipt Admin permission set to see this page.
| Option | Choices |
|---|---|
| How often should the job run? | Every 10 minutes, Every 30 minutes, Every hour, Every 12 hours, or Every day (the default). |
| When should the job run? | Shown only for Every 12 hours and Every day. Pick the hour. Every 12 hours runs at that hour and 12 hours later. The time is in your own Salesforce time zone, which is shown next to it. |
| Action | Create receipts only, or Create receipts and email them (the default). |
Click Schedule. The other frequencies run on the clock: every 10 minutes runs at :00, :10, :20 and so on, every 30 minutes at :00 and :30, and every hour at :00.
Run It as Someone Who Can See Everything
The job runs as the person who scheduled it, and only selects gifts and receipts that person can see in Salesforce. Schedule it as a user who can view all the records it needs, such as a System Administrator. If that user is later deactivated, the job stops running. Delete it and schedule it again as another user.
One Job at a Time
You can have only one scheduled job. Once it is scheduled, the page shows its details instead of the form:
- Action and Frequency
- Next Run and Previous Run
- Created Date, Created By, Timezone and Status
Click Refresh to update the details. To change the frequency, time or action, click Delete and schedule the job again.
Which Gifts Get a Receipt
Each run picks up Gift Transactions that:
- have a Receipt Status of "Eligible". Gifts that are "Eligible for Consolidated" are left for Batch Receipts.
- are not part of a gift commitment. Those are receipted from the commitment or with Batch Receipts.
- have a Transaction Date of yesterday or later. "Yesterday" is worked out in the time zone of the person who scheduled the job. Gifts dated today or in the future are included.
Each selected gift then goes through the same checks as a single receipt from Batch Receipts, so an eligible gift can still be skipped. The Receipt Eligibility article explains the Receipt Status values and why a gift might be skipped. Once a gift is receipted its Receipt Status changes, so a later run doesn't receipt it again.
Back-dated gifts are missed. A gift entered today with a Transaction Date from last week is never picked up. Neither is an older gift that becomes eligible later, for example when it is marked "Paid" or its donor's address is fixed. Use Batch Receipts with a date range to catch these.
Note: With a daily run, the "yesterday or later" window covers gifts entered the day before. If gift entry runs a few days behind, run Batch Receipts for those gifts, or schedule the job more often.
Which Receipts Get Emailed
With the Create receipts and email them option, the email step starts once the run's .pdfs are all finished, or straight away if the run created no receipts. It selects every receipt that:
- has a Receipt Delivery Status of "To be Emailed": the donor prefers email, and the receipt has an email address, an email template and its .pdf,
- hasn't been emailed yet (Receipt Emailed is unchecked), and
- has a Receipt Issue Date of yesterday or later. "Yesterday" is worked out in the time zone of the person who scheduled the job.
This isn't limited to the receipts the run just created. Receipts issued today or yesterday with the New Receipt button, with Batch Receipts or by an earlier run are emailed too, if they are still waiting.
Older receipts are never emailed by the job. A receipt still "To be Emailed" with an earlier Receipt Issue Date stays waiting. That includes receipts whose email failed or hit the daily limit and weren't sent before the window passed, receipts from a day the job was skipped, and receipts whose Receipt Issue Date was changed to an earlier date. Send these from Batch Receipts > Email receipts.
How the Emails Are Sent
- Emails always go through Salesforce, even when Send Emails Using is set to "Amazon SES". Dryad Mailer is used only by Batch Receipts > Email receipts.
- Each email uses the receipt's email template and sender address, and has the receipt's .pdf attached. The Email Setup article explains who receives the email.
- Emails are sent in groups of Receipt Batch Size. Before each group, the app checks the Daily Email Limit and the email allowance Salesforce has left. If the group would go over either one, it isn't sent. The error goes in the log, and those receipts are picked up by the next run while their Receipt Issue Date is still yesterday or later.
- If an email fails, Receipt Emailed stays unchecked and the next run tries again, again only while the Receipt Issue Date is in the window.
With the Create receipts only option, nothing is emailed. Receipts wait as "To be Emailed" until you send them from Batch Receipts > Email receipts, or with the Email Receipt button on each receipt.
When a Run Is Skipped
A run does nothing, with no receipts and no emails, if a "Create Receipts" or "Create .pdfs" job started today is still "In Progress". That includes the previous run of the scheduled job and anything started from Batch Receipts. This stops two jobs from receipting the same gifts or emailing the same receipts twice. The next run picks up where it left off.
It works the other way too: while the scheduled job is creating or emailing receipts, Batch Receipts asks users to wait before they start creating or emailing receipts.
Before checking, the run closes any "Create .pdfs" logs whose jobs ended without finishing them, so a stalled log doesn't block the job for good.
Note: If you schedule the job every 10 or 30 minutes, a large Batch Receipts run during the day pauses the scheduled job until it finishes. That is expected.
Following a Run in the Logs
Each run writes Batch Receipt Logs, which you can find on the Batch Receipt Logs tab:
| Log Action | Shows |
|---|---|
| Create Receipts | The gifts selected (Records Targeted) and the receipts created (Records Processed). |
| Create .pdfs | The .pdfs created for that run's receipts, linked to its "Create Receipts" log. |
| Email Receipts | Only with Create receipts and email them. The receipts issued today or yesterday that were waiting to be emailed (Records Targeted), how many were sent, and any errors. |
A run that was skipped writes no logs. A run that found no gifts still writes a "Create Receipts" log with 0 records.
Troubleshooting
| Symptom | Check |
|---|---|
| A gift didn't get a receipt | Check its Receipt Status is "Eligible", that it isn't part of a gift commitment, and that its Transaction Date was yesterday or later when the job ran. Otherwise, receipt it with Batch Receipts or the New Receipt button. |
| No logs at the time the job should have run | Look for a "Create Receipts" or "Create .pdfs" log from today that is still "In Progress". Check the job's Status and Next Run on the Scheduled Jobs page, and that the user in Created By is still active. |
| Receipts were created but not emailed | Check the job's Action is Create receipts and email them. Open the receipt: its Receipt Delivery Status must be "To be Emailed". "To be Printed" means the donor doesn't prefer email, or the receipt is missing an address or email template. |
| The Email Receipts log says the daily limit was reached | The Daily Email Limit or Salesforce's allowance was used up. The receipts are still waiting and go out on a later run if their Receipt Issue Date is still yesterday or later. Otherwise send them from Batch Receipts > Email receipts. See the Email Setup article for the limits. |
| A receipt is "To be Emailed" but the job never sends it | Check its Receipt Issue Date. The job only emails receipts issued yesterday or later. Send older ones from Batch Receipts > Email receipts. |
| Some gifts or receipts are never picked up | The person in Created By may not be able to see them. Schedule the job again as a user who can see all records. |