Hato Hone St John customer documents

SFDocs History Load Plan

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.

  • Org Production
  • Status Plan, not started
  • Prepared 07-Dec-26
Contents
  1. Overview
  2. How a document is created
  3. Three places a PDF is filed
  4. What staff see
  5. How it runs
  6. How many
  7. Year, type or product
  8. Night-by-night plan
  9. Limits
  10. Before it starts
  11. Recommendation

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.

How a document is created todayMy StJohnfinance systemSFDocsin SalesforceStaffProducedFiled and noticedQueuedBuiltRegisteredOpenedProduces the PDFinvoice, receipt,credit note, certificateFiles it on theOrder, the booking orthe Telecare billingtransactionFile triggerPDF + file nameInvoice_ Cert_ …Queue rowPendingDocumentStaging__cBackground job20 at a time; readsOrder, booking orbilling scheduleDocument rowaccount, order,product, numberDocument__cDocuments tabAccount and Contactlogs every viewOpens the customerView or ZIP
  • My StJohn
  • SFDocs in Salesforce
  • The document row
  • Staff
The file is never copied: the document row points at the PDF that was sent to the customer. If the trigger ever misses a file, a catch-up batch finds it later by date.
  1. Produced. The finance system creates the PDF and My StJohn files it in Salesforce.
  2. Noticed. The file trigger keeps only PDFs on an Order, a booking or a Telecare billing transaction whose name starts Invoice_, CreditNote_, DonationRcpt_ or Cert_.
  3. Queued. One queue row per PDF, so saving the file never waits for SFDocs.
  4. 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.
  5. Registered. One document row per PDF. The same number twice is flagged, not duplicated.
  6. 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 onDocumentsFile name startsAccount and order fromProduct from
OrderInvoice, credit note, donation receiptInvoice_ CreditNote_ DonationRcpt_The OrderThe order's products, main product first
BookingTraining certificateCert_The order behind the bookingThe course
Telecare billing transactionTelecare invoiceInvoice_The billing scheduleThe 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.
Mockup with sample rows
AccountSample Household (5800001)
DetailsOpportunitiesOrdersServicesDocumentsMore
Documents
FinancialCertificates
All datesSearch number, name, attendee or product
TypeNumberOrderProductIssuedStatusDocumentActions
Invoice3524181801723617Ambulance Membership Joint+102/12/2026ActiveInvoice_35241818_Combined_4476162View
Donation Receipt3524181901723617Donation+102/12/2026ActiveDonationRcpt_35241819_Run_4476163View
Invoice3521044001720022First Aid Level 114/11/2025ActiveInvoice_35210440_Combined_4401870View

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 the history load runsHistory loadnights onlyHistory sliceone date range,for example a quarterHourly job19:00 to 07:00 only;one slice at a timeBatch finds old PDFsby date and file name;skips known filesQueue rowstagged withthe sliceSame background jobnew documents first;pauses if fewer than100,000 jobs leftDocument rows, as today
New documents always go first. Untick the setting or stop a slice to pause; files already registered are skipped on a rerun.

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.

PDFs filed before go-live1,319,644About 1.27 million will register; the rest have no Order, booking or billing link.
Financial732,01455%Certificates587,63045%
Matching PDFs per year100k200k300k02k2018–19Night 1189k2020Night 11140k2021Night 10–11154k2022Night 9–10190k2023Night 8–9227k2024Night 6–7218k2025Night 4–5301k2026Night 1–3Certificates90,054Financial210,634

Per year filed. Hover or tap a year for its split; the night labels match the plan below.

Year filedFinancialCertificatesTotalSizeNights
2026210,63490,054300,6881–3
2025125,36892,420217,7884–5
2024136,61390,852227,4656–7
202397,43992,168189,6078–9
202269,67384,079153,7529–10
202156,94082,719139,65910–11
202033,84755,33889,18511
2018–191,500–1,50011
All years732,014587,6301,319,6441–11

Year, type or product?

Not possible

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.

Possible, little gain

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.

Recommended

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.

Night 177k6%
Night 2104k14%
Night 3113k22%
Night 4108k31%
Night 5110k39%
Night 6110k47%
Night 7117k56%
Night 8150k68%
Night 9157k80%
Night 10142k91%
Night 11125k100%

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.

NightSlices (newest first)Documents
1Nov 2026 (to 1 Dec); Oct 202677,493Measured night
2Jul–Sep 2026104,490
3Apr–Jun 2026; Jan–Mar 2026112,827
4–52025, quarter by quarter217,788
6–72024, quarter by quarter227,465
8Oct–Dec, Jul–Sep, Apr–Jun 2023149,916
9Jan–Mar 2023; Oct–Dec, Jul–Sep, Apr–Jun 2022157,432
10Jan–Mar 2022; Oct–Dec, Jul–Sep, Apr–Jun 2021141,808
11Jan–Mar 2021; 2020; 2018–2019124,547Finished

Limits it stays within

LimitProduction allowsOne night of the loadHeadroom
Background jobs a day250,000About 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 once5 running, 100 waiting1: slices run one after anotherNo pressure
Queries and CPU per job200 queries, 60 sA job stops early before either limitCertificates use more queries, so their jobs carry fewer documents
Data storage79.9 GB freeAbout 5 GB for the whole historyClearing finished queue rows afterwards gives about half back

Before it starts

No code change and no deployment.

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.

StepWhat it isCode change
Give the person watching the history-load permission setPermission set assignment in SetupNo
Create the 30 slices, newest firstData: run the prepared slice script onceNo
Switch it on: window 19:00 to 07:00, 20 documents a job, keep 100,000 jobs freeOne setting record in SetupNo
Start the hourly jobRun the schedule script onceNo
Optional: weekends all dayChange the window on Friday, back on MondayNo
Afterwards: clear the finished queue rowsBulk data deleteNo
  1. Assign the history-load permission set to whoever watches the load. It shows slice progress and the queue.
  2. Create the slices, newest first: night 1 as one month plus October 2026, then quarters, with the prepared slice script.
  3. 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.
  4. Schedule the hourly job once with the schedule script. It starts the next slice when the previous one is done, inside the window only.
  5. 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.
Counts and speed from read-only queries in Production, 2 and 7 December 2026. The mockup uses sample rows. Prepared 07-Dec-26.