| Type | Number | Order | Product | Issued | Status | Document | Actions | |
|---|---|---|---|---|---|---|---|---|
| Invoice | 35241818 | 01723617 | Ambulance Membership Joint+1 | 02/12/2026 | Active | Invoice_35241818_Combined_4476162 | View | |
| Donation Receipt | 35241819 | 01723617 | Donation+1 | 02/12/2026 | Active | DonationRcpt_35241819_Run_4476163 | View | |
| Invoice | 35210440 | 01720022 | First Aid Level 1 | 14/11/2025 | Active | Invoice_35210440_Combined_4401870 | View |
How a customer document is created in Salesforce today, and the plan to load the 1,319,644 PDFs filed before go-live without straining Production.
Overview
Since go-live on 2 December 2026 every new invoice, credit note, donation receipt, Telecare invoice and training certificate appears in the Documents tab within seconds. The PDFs filed before go-live are still on their Orders, bookings and Telecare billing transactions. This page shows how a document is created today, and the plan to bring the older ones in.
- 1,319,644PDFs filed before go-live732,014 financial, 587,630 certificates. About 1.27 million will register; the rest have no Order, booking or billing link.
- About 11NightsAt about 150,000 documents a night, 19:00 to 07:00. Weekends all day bring it to about a week and a half.
- 240Documents a minuteMeasured in Production on 2-Dec-26: 860 documents in 44 jobs of 20.
- 7,500–10,000Background jobs a nightAgainst 250,000 allowed a day; 100,000 always kept free.
Recommendation. Load the history by date, newest first, a quarter at a time, inside the 19:00 to 07:00 window. Watch the first night (one month plus October 2026) to measure certificate speed, then let the hourly job run the rest, about 11 nights.
How a document is created today
Nobody files anything by hand. A document is registered because the PDF was produced and filed on its record.
- My StJohn
- SFDocs in Salesforce
- The document row
- Staff
- Produced. The finance system creates the PDF and My StJohn files it in Salesforce.
- Noticed. The file trigger keeps only PDFs on an Order, a booking or a Telecare billing transaction whose name starts
Invoice_,CreditNote_,DonationRcpt_orCert_. - Queued. One queue row per PDF, so saving the file never waits for SFDocs.
- Built. A background job takes 20 rows at a time and reads the record the PDF is on: account, order, product, number and dates; for a certificate also the attendee and expiry.
- Registered. One document row per PDF. The same number twice is flagged, not duplicated.
- Opened. Staff see it on the Account or Contact, open it or download several as a ZIP; every view is logged.
Three places a PDF can be filed
| Filed on | Documents | File name starts | Account and order from | Product from |
|---|---|---|---|---|
| Order | Invoice, credit note, donation receipt | Invoice_ CreditNote_ DonationRcpt_ | The Order | The order's products, main product first |
| Booking | Training certificate | Cert_ | The order behind the booking | The course |
| Telecare billing transaction | Telecare invoice | Invoice_ | The billing schedule | The schedule's Telecare service |
What staff see
New and history documents look the same in the tab. A history document keeps its original issue date, so it sorts below the newest ones: in the mockup the third row was filed in November 2025 and arrives with the history load.
- Product shows the first product; +1 means more, listed on hover.
- Search matches number, name, attendee or product.
- View opens the original PDF.
How the history load runs
The history load uses the same path as today, fed by a batch instead of the trigger, and only at night.
How many
Read-only counts in Production on 7 December 2026, with the batch's own filter. Telecare invoices are Invoice_ files, so they sit inside the financial figures. Documents filed from 2 December 2026 are already registered.
Per year filed. Hover or tap a year for its split; the night labels match the plan below.
| Year filed | Financial | Certificates | Total | Size | Nights |
|---|---|---|---|---|---|
| 2026 | 210,634 | 90,054 | 300,688 | 1–3 | |
| 2025 | 125,368 | 92,420 | 217,788 | 4–5 | |
| 2024 | 136,613 | 90,852 | 227,465 | 6–7 | |
| 2023 | 97,439 | 92,168 | 189,607 | 8–9 | |
| 2022 | 69,673 | 84,079 | 153,752 | 9–10 | |
| 2021 | 56,940 | 82,719 | 139,659 | 10–11 | |
| 2020 | 33,847 | 55,338 | 89,185 | 11 | |
| 2018–19 | 1,500 | – | 1,500 | 11 | |
| All years | 732,014 | 587,630 | 1,319,644 | 1–11 |
Year, type or product?
By product
A slice picks files by date and file name. The product is only known after each document is built from its Order or billing transaction, so slicing by product would mean reading every Order first.
Same documents in the end, so no limit is eased.
By document type
Invoices first, then certificates, is possible. It reads the same dates twice and doubles the slices.
Only worth it if invoices must land before certificates.
By date, newest first
Quarters (one month for the first, watched night). Recent documents are the ones staff ask for, each batch query stays small, and any slice can be stopped or rerun on its own.
A whole year (190k to 300k for 2023–2026) does not fit one night; 1 to 4 quarters do.
Night-by-night plan
Newest first, financial and certificates together, at about 150,000 documents a night. The hourly job moves to the next slice by itself; a slice that runs past 07:00 carries on the next night.
Each block is one night, sized by documents. The percentage under each night is how much of the history is in after it. Night 1 is the measured night.
| Night | Slices (newest first) | Documents | |
|---|---|---|---|
| 1 | Nov 2026 (to 1 Dec); Oct 2026 | 77,493 | Measured night |
| 2 | Jul–Sep 2026 | 104,490 | |
| 3 | Apr–Jun 2026; Jan–Mar 2026 | 112,827 | |
| 4–5 | 2025, quarter by quarter | 217,788 | |
| 6–7 | 2024, quarter by quarter | 227,465 | |
| 8 | Oct–Dec, Jul–Sep, Apr–Jun 2023 | 149,916 | |
| 9 | Jan–Mar 2023; Oct–Dec, Jul–Sep, Apr–Jun 2022 | 157,432 | |
| 10 | Jan–Mar 2022; Oct–Dec, Jul–Sep, Apr–Jun 2021 | 141,808 | |
| 11 | Jan–Mar 2021; 2020; 2018–2019 | 124,547 | Finished |
Limits it stays within
| Limit | Production allows | One night of the load | Headroom |
|---|---|---|---|
| Background jobs a day | 250,000 | About 7,500 to 10,000 (20 documents a job) | Last 24 h used 3,515; the load stops itself if fewer than 100,000 would be left |
| Batch jobs at once | 5 running, 100 waiting | 1: slices run one after another | No pressure |
| Queries and CPU per job | 200 queries, 60 s | A job stops early before either limit | Certificates use more queries, so their jobs carry fewer documents |
| Data storage | 79.9 GB free | About 5 GB for the whole history | Clearing finished queue rows afterwards gives about half back |
Before it starts
Everything the plan needs is already in Production: the history load, its slices, setting and hourly job came with Release 1, and Release 2 taught the batch to find Telecare invoices. Starting it is configuration and data only. Each step still changes Production, so each needs the release lead's go.
| Step | What it is | Code change |
|---|---|---|
| Give the person watching the history-load permission set | Permission set assignment in Setup | No |
| Create the 30 slices, newest first | Data: run the prepared slice script once | No |
| Switch it on: window 19:00 to 07:00, 20 documents a job, keep 100,000 jobs free | One setting record in Setup | No |
| Start the hourly job | Run the schedule script once | No |
| Optional: weekends all day | Change the window on Friday, back on Monday | No |
| Afterwards: clear the finished queue rows | Bulk data delete | No |
- Assign the history-load permission set to whoever watches the load. It shows slice progress and the queue.
- Create the slices, newest first: night 1 as one month plus October 2026, then quarters, with the prepared slice script.
- Switch it on in the SFDocs History Load setting: window 19:00 to 07:00, 20 documents a job, keep 100,000 daily jobs free.
- Schedule the hourly job once with the schedule script. It starts the next slice when the previous one is done, inside the window only.
- Watch night 1 and set the pace for the rest from the measured speed.
The hourly job runs as the person who schedules it, in that person's time zone, so it should be scheduled by an administrator on New Zealand time. The slice script is prepared with the 30 slices of this plan and has not been run.
Pause any time. Untick Enabled in the setting, or set a slice to Stopped. Nothing already registered is touched.
Recommendation
- Slice by date, newest first, by quarter, financial and certificates together. Not by product, which cannot be selected before documents are built.
- Watch night 1 (one month plus October 2026) to measure certificate speed, then let the hourly job run the remaining slices.
- Keep the guard rails: 19:00 to 07:00, 20 documents a job, 100,000 daily jobs kept free. Add weekends all day only if it needs to finish sooner.
- Afterwards, clear the finished queue rows to give the storage back.